1.find . -atime -2 查找两天内访问文件
2.find . -type d 按类型查找,d 当前目录,查找当前目录下的所有目录
3.find /data/ -perm 755 按文件权限查找
4.find /data -path "/data/dir3" -prune -o -print 忽略目录
find /data \ ( -path /data/dir2 -o -path /data/dir3 \ ) -pure -o -print
5.find . -maxdepth 1 -type d 查找一级目录
6.find / -regex "find" find 正则
find / -regex ".*find"
find . -regextype "posix-egrep" -name '*[0-9]'
6. find . -type f -exec Is -l {} \;
7. find . -type f -mtime +14 -exec rm {} \; 在目录中查找更改时间在14天以前的文件,并删除
8.find /root/data -type f -name "*oldboy.txt" | xargs rm -f
9.find /oldboy -name "*.sh" -exec sed -i 's#./hostlists.txt#../idctest_iplist#g' {} \; 查找替换
find /oldboy -name "*sh"|xargs sed -i "s#./hostlists.txt#../idctest_iplist#g'
sed -i 's#./hostlists.txt#../idctest_ip_list#g' 'find /oldboy -name "*.sh" '
10.tar zcvf oldboy.tar.gz 'find /oldboy -type f -name "test.txt"
find /oldboy -type f -name "test"|xargs tar zcvf oldboy01.tar.gz
11.find . -type f|xargs sed -i "s#<script language=javascript src=http://%4%66/x.js?google_ad=93x28_ad><script>##g'
12.apache /app/logs 保留七天日志
for n in 'seq 14'
do
data -s "2014/08/$n
touch access_www_'(date +%F)'.log
done
date -s "2014/08/15"
1) find . -type f -name "access*.log" -mtime +7|xargs rm -f
2)find . -type f -name "access*.log" -mtime +7 -exec rm -f {} \;
13.find . -type f | xargs echo oldboyedu xargs 比 exec 效率高
find . -type f |xargs -n 3 echo oldboyedu