& Nbsp; correct use of the symbols on the keyboard can help you fully apply various techniques when writing simple scripts [Tab] to automatically complete a command and path or file name [root @ localhost ~] # After entering the user, the user can press the [Tab] Key twice on the keyboard to list the commands starting with the user
Correct use of the symbols on the keyboard can help you fully apply various techniques when writing simple scripts.
[Tab] is used to automatically complete a command, path, or file name.
[Root @ localhost ~] # After entering the user, the user can connect to the [Tab] key on the keyboard to list commands starting with the user.
[Root @ localhost ~] # After entering usera, usera can press the [Tab] key on the keyboard to automatically complete the useradd command starting with usera.
[Root @ localhost ~] # After useradd is input, you can press the [Tab] Key twice on the keyboard to list all files and directories in the current directory.
~ This symbol represents the user's home directory.
[Root @ localhost ~] # Cd/
[Root @ localhost ~] # Pwd
[Root @ localhost ~] # Cd ~
[Root @ localhost ~] # Pwd
! Add this symbol before a command to call the previous command starting with this command in the Command History [root @ localhost ~] # Find/root/install. log
[Root @ localhost ~] # File/root/install. log
[Root @ localhost ~] #! F The command will call file/root/install to find the file.
[Root @ localhost ~] #! Fi will call the file/root/install command to find the file.
[Root @ localhost ~] #! Fin will call the find/root/install command to find the file.
$ Is used to reference a variable.
[Root @ localhost ~] # Myhost = www.liuziyang.cn
[Root @ localhost ~] # Echo $ myhost
& At the end of a command, the task is run in the background
% Indicates the number of a task (the task is not a process ).
[Root @ localhost ~] # While true; do echo hello>/dev/tty2; sleep 1; done &
[Root @ localhost ~] # While true; do echo www.liuziyang.cn>/dev/tty2; sleep 1; done &
[Root @ localhost ~] # [Ctrl] + [alt] + [F2] Here it means to switch to the second console/dev/tty2 and view the output result
After each execution of the following command, switch between [ctrl] + [alt] + [F1] and [F2] to see a result change.
[Root @ localhost ~] # Jobs
[Root @ localhost ~] # Fg % 1
[Root @ localhost ~] # [Ctrl] + z the combination of [ctrl] and z on the keyboard
[Root @ localhost ~] # Jobs [root @ localhost ~] # Kill % 2
[Root @ localhost ~] # Jobs
[Root @ localhost ~] # Bg % 1
[Root @ localhost ~] # Jobs
[Root @ localhost ~] # Kill % 1 ''indicates a command or script indicating a string" "indicates a string
Check the output result of each command.
[Root @ localhost ~] # Echo 'hostname'
[Root @ localhost ~] # Echo hostname
[Root @ localhost ~] # Echo "hostname" | pipeline symbol used for filtering after a command statement
[Root @ localhost ~] # Ls-l/etc | more
[Root @ localhost ~] # Cat/etc/passwd | awk-F: {print $7} | sort | uniq
^ Match the start of a string
$ Match the end of a string
> Targeted symbols
<Targeted symbol
> Append symbol
Note that the output results of each command are compared.
[Root @ localhost ~] # Grep ^ root </etc/passwd> result1.txt
[Root @ localhost ~] # Cat result1.txt
[Root @ localhost ~] # Grep bash $ </etc/passwd> result1.txt
[Root @ localhost ~] # Grep bash $ </etc/passwd> result2.txt
[Root @ localhost ~] # Cat result1.txt
[Root @ localhost ~] # Cat result2.txt
[Root @ localhost ~] # Grep root </etc/passwd> result2.txt
[Root @ localhost ~] # Cat result2.txt
Write this first. you can understand these commands and apply them to the actual situation through more hands-on practices.