;
Semicolon, which is used to split multiple commands, each command executes sequentially, but there is no logical relationship between multiple commands, only sequentially (that is, even if the previous command execution fails, it does not affect the execution of subsequent commands)
ls/tmp, Ls/root, Ls/home All commands are executed sequentially sambadiryum.logyum_save_tx-2016-04-06-17-05ucixqg.yumtxyum_save_tx-2016-04-06-17-06bgwk_b.yumtxyum_ Save_tx-2016-04-06-17-19ha4jcb.yumtxyum_save_tx-2016-04-27-03-28kj11ji.yumtx123.txt 12.txt 1.txt Test.txtpzk use1
&&
Used to split multiple commands, each of which executes sequentially, but only after the execution of the current command succeeds && subsequent commands
ls test.txt && cat test.txt Execute cattest.txthelloworld when LS execution succeeds
||
In contrast to &&, only the current execution of a command fails to execute | | Subsequent commands do not execute if the previous command succeeds
ls 888 | | ls test.txt LS Testls is executed when the LS 888 execution fails: unreachable 888: No file or directory Test.txt
ls 1.txt | | ls 2.txt The previous command executes successfully and the following command does not perform a 1.txt
#
Annotation characters
#ls 1.txt The TIC function is commented, and the subsequent command will not be executed after carriage return [[email protected] ~]#
\
Turn special characters into normal characters
[[email protected] ~]# Touch #.txt Touch \#.txt //plus a backslash can remove the function of the pound sign, create a file [[email protected] ~]# ls \#. TXT //view also add backslash #.txt
*
wildcard character, matching all characters
ls *.txt Match all files with a. txt suffix of 123.txt 12.txt 1.txt
?
Match any one character
ls?. TXT //Match any one character 1.txt
;
Continuous instruction, typically used between two commands, while executing two commands
~
Represents the user's home directory
CD ~/tmp/ //view 1.txt files under User's home directory 1.txt
&
Placed at the end of the execution command, which means that the execution command is executed in the background, the same as the use of the accelerator Ctrl + Z. (Jobs view paused process, FG Num recovery process in foreground, BG num recovery process in background, kill%num kill Process)
Firefox & Running Firefox in the background without affecting the current shell [1] 2719
``
An inverted quote that assigns the output of the command in an inverted quotation mark to a variable
a= ' ls ' Assign the result of LS to the variable a[[email protected] ~]# echo $a //view the value of variable a 1.txt 2.txt 3.txt 4.txt
‘‘
Single quotes, when a variable is added with a single quote, is no longer a variable, only if the general character is processed
""
Double quotation marks, which are used to assign a long variable (if not add only one short variable)
{ }
Curly braces, used to match any one of a set of comma-delimited strings
Touch {1,2,3,4,5}.txt Matches any one of a set of comma-delimited strings [[email protected] ~]# ls1.txt 2.txt 3.txt 4.txt 5.txt
mkdir/tmp/ {DIR1,DIR2,DIR3,DIR4}~]# ls/tmp/dir1 dir2 dir3 dir4
If it is a sequential sequence, you can use the ".." To separate:
Touch {1..9 ~]# ls1.txt 2.txt 3.txt 4.txt 5.txt 6. TXT 7.txt 8.txt 9.txt
echo {0..10..2} //Every two to show 0 2 4 6 8 10
$
The $ symbol is prefixed with the variable, and when we want to get the value of the variable or use it, we need to add the $ symbol
[[email protected] ~]# echo $HOSTNAME //Get the value of HOSTNAME root
[ ]
A character range that is used as part of a regular expression to describe a matching range of characters.
[[email protected] ~]# ls [123].txt //Match one character 1.txt 2.txt ls [0-9].txt // can also match characters within the range 1.txt 2.txt 3.txt ls [1-9a-za-z].txt1.txt 2.txt 3.txt 4.txt A.txt
Special symbols in the shell