[root@hf-01 ~]# ls
111 123 1_heard.txt 1_sorft.txt 234 2.txt.bak 3.txt anaconda-ks.cfg
[root@hf-01 ~]# ls *.txt //以.txt结尾的文件都会列出来
1_heard.txt 1_sorft.txt 3.txt
[root@hf-01 ~]# ls *txt //以txt结尾的文件都会列出来
1_heard.txt 1_sorft.txt 3.txt
[root@hf-01 ~]# ls *txt* //包含txt的都会列出来
1_heard.txt 1_sorft.txt 2.txt.bak 3.txt
[root@hf-01 ~]# ls 1* //只要1开头的都会列出来
1_heard.txt 1_sorft.txt
111:
123:
[root@hf-01 ~]#
[root@hf-01 ~]# touch 1.txt 2.txt
[root@hf-01 ~]# ls ?.txt
1.txt 2.txt 3.txt
[root@hf-01 ~]# touch a.txt bb.txt
[root@hf-01 ~]# ls ?.txt
1.txt 2.txt 3.txt a.txt
[root@hf-01 ~]#
[root@hf-01 ~]# ls
111 1_heard.txt 1.txt 2.txt 3.txt a.txt
123 1_sorft.txt 234 2.txt.bak anaconda-ks.cfg bb.txt
[root@hf-01 ~]# ls [0-3].txt
1.txt 2.txt 3.txt
可以把0,1,2,3这四个数字,任意一个都会满足这个条件,[]方括号中的字符只会取一个,就是“或者”的意思
[root@hf-01 ~]# ls [23].txt
2.txt 3.txt
[root@hf-01 ~]# ls [13].txt
1.txt 3.txt
在方括号中可以写范围[0-9a-zA-Z]
[root@hf-01 ~]# ls {1,2,3}.txt
1.txt 2.txt 3.txt
[root@hf-01 ~]#
{1,2,3}.txt和[1-3].txt表达意思一样,或者。只是在{}需要用 , 逗号隔开