将与零个或多个字符匹配。这就是说“什么均可以”。例子: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