-atime #最近时间(天) -mtime #修改时间(天) -ctime #变化时间(天)
-amin #最近时间(分)
-mmin #修改时间(分)
-cmin #变化时间(分)
-size #文件大小
-perm #文件权限
-user #用户文件
find . -type f -atime -7 -print #搜索7天内被访问的文件
find . -type f -atime 7 -print #搜索7天前被访问的文件
find . -type f -atime +7 -print #搜索超过7天被访问的文件
find . -type f -size 2k #搜索等于2k的文件
find . -type f -size +2k #搜索大于2k的文件
find . -type f -size -2k #搜索小于2k的文件
find . -type f -perm 644 #搜索权限为644的文件
find . -iregex '.*(.py|.sh)$' #忽略大小写匹配搜索,".*"表示匹配任意字符
find . ! -name "*.txt" #排除后缀.txt进行搜索,"!"表示排除或者取反
find . -type f -user username #搜索属于用户username的文件
find . -type f -name"*.tmp" -delete #把匹配出来的文件删除
find . -type f -user root -exec chown cs { } ; #把搜索匹配出来的文件所属用户权限进行修改,{ }表示匹配出来的文件名,;表示以chown命令为结尾
find . -type f -name "*.txt" -print0 | xargs -0 rm -rf #删除以.txt结尾的文件,-print0表示以空字符作为分隔符输出
find . -type f -name ".txt" | xagrs -I {} mv {} ./tmp #把管道前面的内容移动到tmp文件夹里面