<> One ,Linux brief introduction

* Linux The core was originally built by Linus the Finn · Towaz (Linus Torvalds) Written out of personal interest at the University of Helsinki
* Linux Is a set of free use and free dissemination classes Unix operating system , Is based on POSIX and UNIX Multiple users of , Multitask , Support for multithreading and multithreading CPU Operating system of
* Linux Able to run the main UNIX Tool software , Application and network protocols . It supports 32 Bitwise sum 64 Bit hardware .Linux Inherited Unix
Design idea with network as the core , It is a multi-user network operating system with stable performance
*
because Linux Open source and other characteristics , There are many popular versions on the market now , The more well-known releases are :Ubuntu,RedHat,CentOS,Debian,Fedora,SuSE,OpenSUSE,Arch
Linux,SolusOS etc.

<> Two ,Linux basic operation

<> Normal user login

Enter the password to log in to the ordinary user

<> Super user login

Click here to enter the user name of the super user first root, Enter the password again to log in successfully , In the learning stage, we usually need super users

<>shell

shell It's also a software in the operating system , It's wrapped in linux Outside the kernel , Provides an interface for the interaction between the user and the kernel , Command in the system shell To explain ,shell
Receive the output of the system response and display it on the screen

Bash (GNU Bourne-Again Shell) It's a lot Linux Default for distribution Shell, Right click on the system desktop to open bash

<> stay shell Execute command in

The command must be entered at the prompt , How to input commands : command parameter target , Parameters and passwords are not required , Common command line prompts are

* [kiosk@foundation0 Desktop]$
* kiosk function bash Users of
* foundation0 bash Host short name
* @ Information separator
* Desktop Current default operation directory
* # Represent superuser
* $ User identity prompt
<> Test some simple commands

<>1,ls command

namely list Abbreviation of , adopt ls Commands can not only be viewed linux Files in folder , And you can view file permissions ( Include catalog , folder , file right ) View catalog information, etc .

Common parameter collocation :
ls -a List all files in the directory , Include with . Start hidden file ls -A List Division . and .. Other documents of ls -r Reverse order ls -t Sort by file modification time ls -S
Sort by file size ls -h Display in readable size ls -l In addition to the filename , Also permissions for files , owner , File size and other information are listed in detail
<>2,cd command

cd(changeDirectory) Command syntax :
cd [ Directory name ]
explain : Switch current directory to dirName.

example :

(1) Enter the desired directory
cd /
(2) get into “home” catalog
cd ~
(3) Enter last working path
cd -
(4) Take the parameters of the last command as cd Parameter usage .
cd !$
<>3,pwd command

pwd Command to view the current working directory path .

example :

(1) View current path
pwd
(2) View the actual path of the soft link
pwd -P
<>4,mkdir command

mkdir Command to create a folder .

Available options :

* -m: Set access to new directory , It can also be used chmod Command settings ;
* -p: Can be a path name . At this time, if some directories in the path do not exist , With this option added , The system will automatically create directories that are not yet available , That is, multiple directories can be created at one time .
example :

(1) The name created in the current working directory is t Folder for
mkdir t
(2) stay tmp The path created under the directory is test/t1/t Contents of , If not , Then create :
mkdir -p /tmp/test/t1/t
<>5,rm command

Delete one or more files or directories in a directory , If not used -r option , be rm Directory will not be deleted . If using rm To delete a file , You can usually still restore the file to its original state .
rm [ option ] file …
example :

(1) Delete any .log file , Ask for confirmation one by one before deleting :
rm -i *.log
(2) delete test Delete all files in subdirectory and subdirectory , And you don't have to confirm one by one :
rm -rf test
(3) Delete to -f File at the beginning
rm -- -f*
<>6,rmdir command

Remove one or more subdirectory entries from a directory , You must also have write access to the parent directory when deleting a directory .

be careful : Cannot delete non empty directory

example :

When parent If the subdirectory is deleted to make it an empty directory , Delete by the way :
rmdir -p parent/child/child11
<>7,mv command

Move or change file name , According to the second parameter type ( Such as table of contents , Move file ; If it is a file, command it again ).

When the second parameter is directory , Multiple files can be separated by spaces as the first parameter , Move multiple files to parameters 2 In the specified directory .

example :

(1) File test.log Rename to test1.txt
mv test.log test1.txt
(2) File log1.txt,log2.txt,log3.txt Move to root test3 In the catalog
mv log1.txt log2.txt log3.txt /test3
(3) File file1 Renamed file2, If file2 Already exists , Ask if you want to overwrite
mv -i log1.txt log2.txt
(4) Move all files under the current folder to the previous directory
mv * ../
<>8,cp command

Copy source file to destination file , Or copy multiple source files to the destination directory .

be careful : Command line copy , If the target file already exists, you will be prompted whether to overwrite it , And in shell In script , If not -i parameter , Will not prompt , It's direct coverage !
-i Tips -r Copy directory and all items in the directory -a The time of the copied file is the same as that of the original file
example :

copy a.txt reach test Directory , Time to keep original documents , If there is a prompt in the original file, do you want to overwrite it .
cp -a a.txt test
<>9,cat command

Show entire file , Note that this command does not display directories
cat filename
<>10, --help Help command

<>11,date Display current system time
```shell [root@localhost Desktop]# date '+%c' Sat 10 Aug 2019 10:32:38 PM PDT
[root@localhost Desktop]# date '+%D' 08/10/19 [root@localhost Desktop]# date
'+%x' 08/10/2019 [root@localhost Desktop]# date '+%T' 22:33:51 [root@localhost
Desktop]# date '+%X' 10:34:04 P ```
<>12,cal Display the calendar of the current month by default

<>13,less command

less And more similar , But use less You can browse files at will , and more Move forward only , But can't move back , and less The entire file will not be loaded until it is viewed .

Common command parameters :
-i Ignore case when searching -N Show line numbers for each line -o < file name > take less The output is saved in the specified file -s Show a row of consecutive empty lines
/ character string : Search down “ character string ” Function of ? character string : Search up “ character string ” Function of
example :
View multiple files
less 1.log 2.log
have access to n View next , use p View previous .

<>14,head command

head Used to display the beginning of a file to standard output , default head Command to print the beginning of its corresponding file 10 That's ok .

Common parameters :
-n< Number of rows > Number of lines displayed ( The number of lines is complex, indicating the number from the last to the front )
example :

(1) display 1.log Before in file 20 That's ok
head 1.log -n 20
(2) display 1.log Before document 20 byte
head -c 20 log2014.log
(3) display t.log last 10 That's ok
head -n -10 t.log
<>15,tail command

Used to display the content at the end of the specified file , When no file is specified , Process as input . Common view log files .

Common parameters :
-f Circular reading ( Commonly used to view incremental log files ) -n< Number of rows > Show rows ( Back to front )
example :
display filename last 20 That's ok .
tail -n 20 filename
<> Three ,SHELL Historical calls in

* history Show history
* Up down key Search history one by one
* ! number Call this number history
* ! letter Call recent history starting with this letter
* ctrl+r+ keyword Call the latest history with this keyword
* history -c Clear current shell History in
<> Four , Common shortcut keys in the current system

Technology
©2019-2020 Toolsou All rights reserved,
Message quality platform series | Full link troubleshooting What is? FPGA? New York Youth Project “ Recapture Wall Street ”: Safeguarding the interests of retail investors Redis Queue implementation java Second kill system , No script , It can be used in production Don't annoy the panda with any cat !「 Kung Fu Panda 」20 It's the year of man 4 blood cartoon | CPU Warfare 40 year , The real king finally appeared !JS How to operate 20 Review strategy for senior students with high marks !!! Big data tells you , How tired are Chinese women MySQL An interview is a must !