========测试环境: Fedora Core 6.0;内核:2.6.18======== 1 关于通配符 [root@localhost doc]# find /usr/doc -name "k*" -print /usr/doc/k3b~ /usr/doc/k3b
#find使用通配符的时候需要加引号,如果不加,FC将会提示:
[root@localhost doc]# find /usr/doc -name k* -print #find: 路径必须在表达式之前 Usage: find [-H] [-L] [-P] [path...] [expression]
#还有一种解决方法: [root@localhost doc]# find /usr/doc -name k\* -print /usr/doc/k3b~ /usr/doc/k3b
#以上的解释在: In this case the * is expanded by the shell.If the pattern matches a single filename in the current directory(such as mbar or mfram),the expanded name will be passed to find as a parameter.
2 关于快速搜索 #其实快速搜索就是细化路径,来较少时间和CPU的消耗。
[root@localhost doc]# find /usr/doc -name k3b -print
[root@localhost doc]# find / -name k3b -print
#可以比较出时间的差异。
3 文件创建时间搜索 [root@localhost doc]# echo aaa>tmp [root@localhost doc]# ls tmp tmp [root@localhost doc]# find ./ -ctime 0 ./ ./tmp #也就是搜索当天搜索的东西。注意目录的使用技巧。这个目录技巧最早我是在生成C程序的时候用到的。
[root@localhost doc]# find ./ -atime 0 ./ ./60.pdf ./FC5_help ./FC5_help/FC5_1_files ./aa ./nce2 ./note ./nce1 ./sx ./nce3 ./bm ./nce4 ./tmp #以上是atime的结果,atime表示“读取过的”。 --------------------- 其他参数没有特别说明,自行参考man。 标签: Linux Commands |