將與零個或多個字符匹配。這就是說「什麼均可以」。例子:shell
? 與任何單個字符匹配。例子:bash
註釋code
\ 符號使其後面的字符只是做爲字符自身,不會體現該字符的意義排序
[root@localhost ~]# a=123;b=456 [root@localhost ~]# c=$a$b [root@localhost ~]# echo $c 123456 [root@localhost ~]# c=\$a\$b [root@localhost ~]# echo $c $a$b
管道「| 」就是將前面命令輸出做爲管道後面命令的輸入 而cut是截取字符串。cut 分割,-d 分隔符 -f 指定第幾段 -c 指定第幾個字符字符串
[root@localhost tmp]# cat 2.txt |cut -d ":" -f 1 root bin daemon adm [root@localhost tmp]# cat 2.txt |cut -d ":" -f 1,2 root:x bin:x daemon:x adm:x
參數:file
[root@localhost tmp]# cat 2.txt root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin [root@localhost tmp]# sort 2.txt adm:x:3:4:adm:/var/adm:/sbin/nologin bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin root:x:0:0:root:/root:/bin/bash
[root@localhost tmp]# wc -l 2.txt 4 2.txt [root@localhost tmp]# wc -w 2.txt 4 2.txt [root@localhost tmp]# wc -m 2.txt 142 2.txt
[root@localhost tmp]# cat 3.txt 112233 223344 334455 556677 112233 223344 [root@localhost tmp]# sort -n 3.txt | uniq 112233 223344 334455 556677
tee和>相似是重定向輸出的意思,tee -a 相似>>重定向追加,好比把3.txt排序,去重而後輸出到1.txt中的命令爲:統計
[root@localhost tmp]# sort 3.txt | uniq |tee 1.txt 112233 223344 334455 556677 [root@localhost tmp]# cat 1.txt 112233 223344 334455 556677
tee與>不一樣的是,它會把重定向的內容顯示在屏幕上,而>則不會。sort
tr aa bb =將字符aa換成字符bb重定向
[root@localhost tmp]# cat 1.txt 112233 223344 334455 556677 [root@localhost tmp]# tr '11' '99' < 1.txt 992233 223344 334455 556677
「||」字符用在兩條命令之間,表示前面命令執行不成功,就執行後面的命令註釋
[root@localhost tmp]# cat 5.txt || cat 1.txt cat: 5.txt: 沒有那個文件或目錄 112233 223344 334455 556677 [root@localhost tmp]# cat 1.txt || cat 5.txt 112233 223344 334455 556677
&&字符表示前面命令執行成功了,纔會執行後面命令
[root@localhost tmp]# mkdir lic && mv 1.txt lic [root@localhost tmp]# ls 2.txt 3.txt lic [root@localhost tmp]# tree lic/ lic/ └── 1.txt 0 directories, 1 file