Basic features of linux
(1) Complete
Command Completion
Path completion
(2) Shortcut key
ctrl +c terminates the foreground operation
+d exit
+l clear screen
+a move the cursor to the front of the command
+Move the e-beacon to the back end of the command
+u deletes all characters in front of the cursor
+k delete all characters after the cursor
+r search history command, using keywords
(3) Command history
history
echo HISTSIZE # process can retain the number of command history entries
-c # clear history command
-d offest # deletes the specified command history
-r # read command history from file to history list
## show recent # commands
!# # What is the number of items in the execution history command at one time
# Execute the previous command again
! STRING # the last command that starts with STRING in the history list of one-time executed commands
(4) Named alias
alias
Name = 'COMMAND' # name alias
unalias
name # undo alias
vi /etc/bashrc # persistent alias
(5) Variable
Effective range of local variables: some code fragments in shell process, usually referring to functions
Effective range of local variable: current shell process
Effective range of environment variables: current shell process and child process
(6) Special important symbols
|Pipe symbol
. current directory
... upper level directory
; When executing multiple commands, use; separate
``Inverted single quotes, command substitution
, single quotation mark, strong reference, no variable replacement
"" double quotation marks, which can replace variables and commands
{} extend or build blocks of code
*Indicates the function of general distribution
(7) I / O redirection
grep "root" < / etc / passwd # output redirection
dd if=/dev/zero of =/file1 bs =1M count=10
(8) Command line wildcards
*Matches any character of any length
? Match any single character
[] matches any single character within the specified range
[^] matches any single character outside the specified range
(9) Common system management commands
1)ls
-a # displays all files, including hidden files
-A # displays all files, including hidden files, but excluding the current directory and the previous directory
2) pwd # displays the current working directory
(10)date
1)date +"%Y-%m-%d" #2021-6-26
2)date -d"1 day ago" + "%Y-%m-%d" #2021-6-25
(11)passwd
-k # retain users who are about to expire and can still be used after expiration
-d # delete user password
-l # lock the user
-u # unlock
-x # maximum number of days for two password corrections
-n # two minimum password corrections
-w # how many days does it take to remind users to change their password
-i # how many days after the password expires, the user is banned
-S # user password status, which can only be operated by root user
(12)who
-a # the designated file of all information of the file
-b # latest system startup time
-d # displays all expired processes that have not been flushed or generated by init
-l # list any login processes
-m # enter the information about the current terminal
-r # displays the level of the current run
-s # only name, route and time period are listed
-t # user's last change to the system clock with the date command
-u # displays the user name, tty, login time, line activity and process ID of the current user
(13)uname -a #full detail -s #Kernel name -n #Node or host name -r #Displays the linux operating system kernel version number -v #Displays the version of the operating system -p #Displays the processor type -i #Displays the hardware platform type -o #Displays the operating system name (14)w -f #Turn on or off display where users log in to the system -h #The title information column of each field is not displayed -l #Use detailed table list -s #Use a concise format list -V #Display version information (15)last -a #The host name or ip address of the system logged in from where is displayed in the last line -d #Convert ip address to host name -n #Set the number of columns displayed in the list -f #Specify record file -x #Display information such as system shutdown, restart, and change of registration (16)dmesg(Display boot information (command) -c #After the message is displayed, clear the contents in the ring buffer -s<Buffer size> #It is preset to 8196, which is just equal to the size of ringbuffer -n #Set record information level Main purpose (1)It is found that the performance of the hard disk is low and can be used demsg To check if they're running DMA pattern dmesg|grep DMA (2)If there is a problem with the Ethernet connection demsg | grep eth (3)Detect system kernel loading demsg | grep -i "(apm|acpi)" (17)free(By default, the KB (unit) -b #Displays memory usage in byte s -k #In kilobytes -m #In MB -g #In GB -o #Do not display buffer reallocation -s <Interval seconds> #Continuously observe memory usage -t #Display memory sum column (18)ps -A #All processes will be displayed -a #Display all processes under the current terminal, including those of other users -u #User dominated process state -x #It is usually used together with a to list more complete information -l #A longer and more detailed list of pid information -j #Format of work -f #Make a more complete output (19)top first line Current system time up The running time of the system so far, the number of users currently logged in to the system, load average Load conditions for the next 1 minute, 5 minutes and 15 minutes And uptime The information displayed is identical Second line tasks Represents a task total Existing process, running, hibernating, suspending, zombie Third line us User occupancy cpu percentage sy Kernel space occupation cpu percentage ni Changed priority occupancy cpu percentage id free cpu percentage wa IO Waiting for occupation cpu percentage hi Hard interrupt occupancy cpu percentage si Soft interrupt occupancy cpu percentage st cover hy[ervisor Stolen time (20)diff (21)ln ln f1 f2 #Create a hard link. Connect through inodes ln -s f1 f3 #Create a soft connection. Also known as symbolic link, also known as soft link