6、按时间查找
查找2天内被更改过的文件
[root@localhost .code]# find . -mtime -2 -type f -print
查找2天前被更改过的文件
[root@localhost .code]# find . -mtime +2 -type f -print
查找一天内被访问的文件
[root@localhost .code]# find . -atime -1 -type f -print
查找一天前被访问的文件
[root@localhost .code]# find . -atime +1 -type f -print
查找一天内状态被改变的文件
[root@localhost .code]# find . -ctime -1 -type f -print
查找一天前状态被改变的文件
[root@localhost .code]# find . -ctime +1 -type f -print
查找10分钟以前状态被改变的文件
[root@localhost .code]# find . -cmin +10 -type f -print
7、按文件新旧
查找比aa.txt新的文件
[root@localhost .code]# find . -newer "aa.txt" -type f -print
查找比aa.txt旧的文件
[root@localhost .code]# find . ! -newer "aa.txt" -type f -print
查找比aa.txt新,比bb.txt旧的文件
[root@localhost .code]# find . -newer 'aa.txt' ! -newer 'bb.txt' -type f -print
8、按大小查找
查找超过1M的文件
[root@localhost .code]# find / -size +1M -type f -print
查找等于6字节的文件
[root@localhost .code]# find . -size 6c -print
查找小于32k的文件
[root@localhost .code]# find . -size -32k -print
9、执行命令
查找del.txt并删除,删除前提示确认
[root@localhost .code]# find . -name 'del.txt' -ok rm {} \;
查找aa.txt 并备份为aa.txt.bak
[root@localhost .code]# find . -name 'aa.txt' -exec cp {} {}.bak \;
