在使用cd命令切换路径时,使用星号还可以省去输入整个路径名的麻烦:
[root@oracle10g qilin]# cd fi*/q*/p*
[root@oracle10g product]# pwd
/root/qilin/find/qilinli/product
列出文件名以任意两个字符开头,接着是l,后面跟任何字符的文件
[root@oracle10g qilin]# ls ??l*
hello.sh qilin.sh
列出文件名以conf开头、中间是任意两个字符、最后以.log结尾的文件:
[root@oracle10g qilin]# ls conf??.log
conf12.log conf13.log conf23.log
co?? * g匹配所有以co开头、中间是任意两个字符、后面跟随任意字符串、并以g结尾的文件名:
[root@oracle10g qilin]# ls co??*g
conf12.log conf13.log conf234.log conf23.log
列出了以 i或o开头的文件名,同时会罗列出子目录中以 i或o开头的文件名:
[root@oracle10g qilin]# ls [fq]*
frist.sh funtest.sh qilin.sh
find:
qilinli
列出所有以数字开头的文件名,可以用:
[root@oracle10g qilin]# ls [0-9]*
23su 32li
列出所有以大写字母开头的文件名,可以用:
[root@oracle10g qilin]# ls [A-Z]*
conf12.log conf13.log conf234.log conf23.log frist.sh funtest.sh grep.sh hello.sh qilin.sh random.sh Su test.sh Wang
find:
qilinli
创建一个文件并将其日期和时间戳设置为所需要的时间
[root@oracle10g qilin]# touch -t 08101430 aiciba
[root@oracle10g qilin]# ll
total 112
-rw-r--r-- 1 root root 67 Jul 26 04:39 '
-rw-r--r-- 1 root root 0 Aug 10 16:44 23su
-rw-r--r-- 1 root root 0 Aug 10 16:44 32li
-rw-r--r-- 1 root root 0 Aug 10 14:30 aiciba
查找比某个文件新或旧的文件
find newest_file_name ! oldest_file_name -exec ls -l {} \;
字符匹配:ls -a | grep ^ ...X
|| 或-逻辑操作:mkdir qilin || ls -l
&& 与逻辑操作:make && make install
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20976446/viewspace-684540/,如需转载,请注明出处,否则将追究法律责任。