找出/tmp目錄下,屬主不是root,且文件名不以f開頭的文件
find /tmp( -not -user root -a -not -name 'f' ) -ls
find /tmp-not ( -user root -o -name 'f' ) –ls
?
排除目錄
?
示例:
查找/etc/下,除/etc/sane.d目錄的其它所有.conf后綴的文件
find /etc-path ‘/etc/sane.d’ -a -prune
-o -name “.conf”
查找/etc/下,除/etc/sane.d和/etc/fonts兩個目錄的其它所有.conf后綴的文件
find /etc(–path ‘/etc/sane.d’ –o –path ’/etc/fonts’ )
-a -prune –o -name “.conf”
備份配置文件,添加.orig這個擴展名
find -name “.conf” -exec cp {} {}.orig ;
?提示刪除存在時間超過3天以上的joe的臨時文件
find /tmp -ctime +3 -user joe -ok rm {} ;
?在主目錄中尋找可被其它用戶寫入的文件
find ~ -perm -002 -exec chmod o-w {} ;
?查找/data下的權(quán)限為644,后綴為sh的普通文件,增加執(zhí)行權(quán)限
find /data –type f -perm 644 -name “.sh” –exec chmod 755 {} ;
?查看/home的目錄
find /home –type d -ls