1.查找 /tmp 目录下名字为 aming开头的所有文件。
2.搜索tmp目录下所属组group1,所属主user1的文件
3.搜索根目录下的 1.txt 2.txt 和 a 目录
4.搜索tmp目录下以 a 开头并且以 c 结尾的文件
5.搜索 tmp 目录下,不是以 a 开头,并且大小超过100M的文件
1
[root@server1 tmp]# find /tmp -type f -name "aming*"
2
[root@server1 tmp]# find /tmp -type f -group group1 -user user1
3
[root@server1 tmp]# find / -type f -name "a.txt" -o -name "b.txt" -o -type d -name "a"
4
[root@server1 tmp]# find /tmp -type f -name "a*c"
5
[root@server1 tmp]# find /tmp -type f ! -name "a*" -a -size +100M
总结如下:刚开始学完在做的时候还是会有一些没有注意到的地方,对查找的命令用的不是很熟悉。主要是没有明确题目的意思。以后在做这种题的话,我建议先明确查找的类型(文件还是目录)在确定查找的路径,是在哪个路径下查找,不写的话默认是当前路径。最后在去琢磨查找的条件。如果题目中有并且等字样 就用 -a选项(and)将前后条件连接起来 如果有或等字样就用-o(or)选项连接起来 如果有不等否定的字样 先把他的肯定形式先写出来,最后在前面取反(!)就行