* Represents 0 or more arbitrary characters
? Represents only one arbitrary character
# comment Symbols
\ de-signifier symbol
[[email protected] ~]# ls #1. txt #将后面内容注释 only run LS
111 1.tar 3.txt Install.log yasuo.zip
111.tar 1.txt anaconda-ks.cfg Install.log.syslog
123.txt 2.txt a.txt Yasuo
[[email protected] ~]# ls \ #1. txt \ de-ideographic character to remove the original meaning
LS: Unable to access #1.txt: There is no file or directory at this time #1.txt as the file name
[email protected] ~]# touch \ #1. txt|ls
111 123.txt #1. txt 2.txt anaconda-ks.cfg install.log Yasuo
111.tar 1.tar 1.txt 3.txt a.txt install.log.syslog yasuo.zip
| Pipe character
The $ variable prefix that gets or uses the variable when it is preceded by the $
!$ represents the last variable in the previous command
[Email protected] ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/tmp/:/data/bin/:/root/bin
[Email protected] ~]#!$
$PATH
-bash:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/tmp/:/data/bin/:/root/bin:
No file or directory
; Used in the middle of two commands (two commands written on one line)
[[email protected] ~]# ls 1.txt; LS 1.tar
1.txt
1.tar
~ User Home Directory
[[email protected] ~]# ls ~
111 123.txt #1. txt 2.txt anaconda-ks.cfg install.log Yasuo
111.tar 1.tar 1.txt 3.txt a.txt install.log.syslog yasuo.zip
& put commands in the background (add & after a command)
[Email protected] ~]# & Sleep
[1] 1647
[[email protected] ~]# jobs
[1]+ Running Sleep &
[[email protected] ~]# jobs
[1]+ done Sleep 10
REDIRECT symbol: >,>>,2<,2<<,<
#echo "123" >1.txt > overwrite the contents of the original file 1.txt
[Email protected] ~]# echo "123" >1.txt
[email protected] ~]# cat 1.txt
123
If you do not want to overwrite with append redirect >>
[Email protected] ~]# echo "456" >>1.txt
[Email protected] ~]# echo "789" >>1.txt
[email protected] ~]# cat 1.txt
123
55W
789
Reverse redirect < Throw a file content to a command
such as: [[email protected] ~]# Wc-l < 1.txt
3
Error redirection:2>,2>>
[[email protected] ~]# ls 11111
LS: unreachable 11111: No file or directory
[[email protected] ~]# ls 11111 > 1.txt will also overwrite the original file content
LS: unreachable 11111: No file or directory [[email protected] ~]# ls 11111 2> 1.txt
[email protected] ~]# cat 1.txt
LS: unreachable 11111: No file or directory
Do not overwrite the original file content:2>>
[[email protected] ~]# ls 11111 2>> 1.txt
[email protected] ~]# cat 1.txt
LS: unreachable 11111: No file or directory
LS: unreachable 11111: No file or directory
[] A character combination in parentheses that represents any of the characters
[[email protected] ~]# ls [123].txt
1.txt 2.txt 3.txt
[[email protected] ~]# ls [1-9a-za-z].txt
1.txt 2.txt 3.txt A.txt
Linux_note Special symbols in the shell