find查找
- 名称查找
touch /etc/sysconfig/network-scripts/{ifcfg-eth1,IFCFG-ETH1}
find /etc -name "ifcfg-etn1"
find /etc -iname "ifcfg-eth1"
find /etc -name "*eth*"
find /etc -iname "*eth*"
- find大小查找
find /etc -size +5M
find /etc -size 5M
find /etc -size -5M
- find类型查找
find /dev -type f
find /dev -type d
find /dev -type l
find /dev -type b
find /dev -type c
find /dev -type s
- find时间查找
find ./ -iname "file*" -mtime -7
find ./ -iname "file*" -mtime 7
find ./ -iname "file*" -mtime +7
find /backup -iname "*.bak" -mtime +7 -delete
find /backup -iname "*.bak" -mtime +30 -delete
- find用户查找
find /home -user username
find /home -group usergroup
find /home -user username -group usergroup
find /home -user username -group -a usergroup
find /home -user username -o -group usergroup
find /home -nouser
find /home -nogroup
find /home -nouser -o -nogroup
- find查找后的动作命令实例
find /home /etc -name "ifcfg*"
find /home /etc -name "ifcfg*" -print
find /etc -name "ifcfg*" -ls
find /etc -name "ifcfg*" -delete
find /etc -name "ifcfg*" -ok cp -v {} /tmp \;
find /etc -name "ifcfg*" -exec cp -v {} /tmp \;
find /etc -name "ifcfg*" -exec rm -f {} \;
find /etc -name "ficfg*" | xargs rm -f
touch file{1..50000}
time find ./ -type f -name "file*" -exec rm -f {} \;
touch file{1..50000}
time find ./ -type f -name "file*" | xargs rm -f
- find,grep 联合使用
find /etc -type f | xargs grep "user*"
- find逻辑运算符(-a -o !)
find . -not -user root
find . ! -user root
find /etc -type f -user root -size +1k
find /etc -type f -user root -a -size +1k
find -type f \( -user root -o -name "*.xml" \)