前置条件
rk
y0N0{051Testing软件测试网k"} X:Jzl1C4Xj
创建一个1G的文件
c/O\fwGu1Mh0fallocate -l 1g istester.com.ini51Testing软件测试网}'{B.t0r ]3`V
51Testing软件测试网NI7c2s}Uq#j'Pd/A
51Testing软件测试网S8|&g
Ep gH6G
51Testing软件测试网7~(f7e2e:Y*_t
}"^
找出当前目录,及其子目录中,大于100M的所有文件51Testing软件测试网Fy.bM:J
DK I:dfj(`Ed0find ./ -type f -size +100M51Testing软件测试网1zKZ MWo
51Testing软件测试网G+D?@W[m]
51Testing软件测试网4P4pZXIjN
大于1G51Testing软件测试网Zx#BN v A8~C7kn}
0Y0mX
nN5oY%@P0find ./ -type f -size +1G51Testing软件测试网"Wk'?$`J+m3duL
51Testing软件测试网!s!@}d,j#XM
51Testing软件测试网{-L$W(Wowu
延伸,51Testing软件测试网Tu!Qp X|MH8K S
!\{F6j8y?7C0# 查找isTester目录下,两层目录内(包含2层子文件夹内的文件),所有大于10M的文件
Z+C-W9K,J!Hi
s'qUP0find ./isTester -maxdepth 2 -size +10M
Hp%tz x7Mz1T!z0
51Testing软件测试网n?y
^"bV9jyt
51Testing软件测试网X1?Cog7hY
51Testing软件测试网QB!JJ{ r+Z u3j(_p
#倒序显示当前路径下,所有大于1M的文件51Testing软件测试网G8a-R w(z:Yi
du -sh ./isTester/* |grep M|sort -nr51Testing软件测试网$`9d4H7X"I:m'is|
51Testing软件测试网oh0yNq\[6ZE
!~+t'?z7M0# 查找当前目录下,所有1级空目录,并删除
t-l(PhM)~g0find ./ -maxdepth 1 -type d -empty | xargs rm -rf
~:Z
|Z#d0或
jmF}6T/M&OzP0find ./ -maxdepth 1 -type d -empty -exec rm -rf {} \;
%JU*E1VHu|t0
51Testing软件测试网gp?Z;bl)[)n
51Testing软件测试网R&h4@P9CD!?@
E#d&r%}-E4c X0#查找isTester目录下,所有的jpg文件,并压缩为isTester_images.tar.gz
.m f[2qB&P7P0find ./isTester -type f -name "*.jpg" | xargs tar -czvf isTester_images.tar.gz51Testing软件测试网uM(r hu
!vy4euI0
7V#I]\Cvgs!K}I0#查找isTester目录下,所有的log文件,并复制到当前的idoxu目录
9B.[%|(pG ?r%sdg0find ./isTester -type f -name "*.log" -exec cp -rf {} idoxu/ \;
9CI/Q:s~-FQ5D:~(V0
51Testing软件测试网r+Gy~V
51Testing软件测试网*\3o#QJ"sgq
# 查找包含xx内容的,所有xx文件
%Fqm0Qd+i|Af({2h0find ./* -name 'config.xml' | xargs grep "isTester"51Testing软件测试网A u*~Rd'^
}xV!D4m)Vq
zP&z0
51Testing软件测试网hgY#~ u-xi^2V0N
在/root/isTester目录下查找更改时间在5日以内的文件
|'}Z-|8}A9_zt:t0find /root/isTester/ -mtime -551Testing软件测试网$M*AH8ScN|)Y
在/root/isTester目录下查找更改时间在3日以前的文件
S8m | S7U0find /root/isTester/ -mtime +351Testing软件测试网"e:o2MM"LJ_7SP.D
51Testing软件测试网Hnsw"m&~_
D
51Testing软件测试网i%|
iJ V x)g,t)@:O
_2Jn9]pv'AR-L051Testing软件测试网+bg)O|0Z
作者:IDO老徐51Testing软件测试网B$W*l+f-R;g0q
原文链接http://istester.com/linux/312.html
%o5Rc3qQ0