* 不包含隐藏文件[root@centos8 data]# touch guanglei.txt[root@centos8 data]# touch TEST.txt[root@centos8 data]# touch .txt[root@centos8 data]# ll *.txt-rw-r--r-- 1 root root 0 Aug 5 05:53 guanglei.txt-rw-r--r-- 1 root root 0 Aug 5 05:53 TEST.txt查看以file开头的任意0个或者多个字符并且以.log结尾的文件
排除了file10.log[root@centos8 data]# ll file?.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file1.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file2.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file3.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file4.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file5.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file6.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file7.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file8.log-rw-r--r-- 1 root root 0 Aug 1 19:21 file9.log[attach]48417[/attach]
前一个工作目录在/data目录下[root@centos8 data]# cd [root@centos8 ~]# ls ~-file10.log file2.log file4.log file6.log file8.log guanglei.txt TEST.txtfile1.log file3.log file5.log file7.log file9.log TEST查看包含file和指定数字(1,2,3,4,5)的文件信息
即查看fileG.html,fileU.html,fileA.html,fileN.html,fileG.html,fileL.html,fileE.html,fileI.html的文件信息[root@centos8 data]# touch /data/file{A..Z}.html[root@centos8 data]# ll /data/file[GUAGNLEI].html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileA.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileE.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileG.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileI.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileL.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileN.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileU.html[attach]48418[/attach]
即查看不是fileG.html,fileU.html,fileA.html,fileN.html,fileG.html,fileL.html,fileE.html,fileI.html的文件信息[root@centos8 data]# ll /data/file[^GUANGLEI].html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileB.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileC.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileD.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileF.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileH.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileJ.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileK.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileM.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileO.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileP.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileQ.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileR.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileS.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileT.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileV.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileW.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileX.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileY.html-rw-r--r-- 1 root root 0 Aug 5 06:06 /data/fileZ.html查看包含指定区间的文件名
a-c包含了a-c之间的大写字母,但是不显示大写的C[root@centos8 data]# touch /data/file{a..z}.html[root@centos8 data]# ls /data/file[a-c].html/data/filea.html /data/fileA.html /data/fileb.html /data/fileB.html /data/filec.html文件通配符还有一些常用的预定义的字符类,可以使用命令 man 7glob 查看
欢迎光临 嵌入式开发交流网论坛 (http://www.dianzixuexi.com/bbs/) | Powered by Discuz! X3.2 |