前置条件
'W,PS rCA#S051Testing软件测试网:b/o"lp7w(u
创建一个1G的文件51Testing软件测试网6aAec3v+m,`
fallocate -l 1g istester.com.ini
~})O&m
?m~8h^N0
51Testing软件测试网X F)RnB%Aql
feo9C!k6n}051Testing软件测试网C
_[Bv4mW%kk
找出当前目录,及其子目录中,大于100M的所有文件51Testing软件测试网6Ren;]~'Ru
c'jM.UxwN0find ./ -type f -size +100M51Testing软件测试网l{,t%H1A.u Rc
51Testing软件测试网R/pQg.p)F~?#u
51Testing软件测试网 O^(ug3ZCaR
大于1G
PU@U8W!L0
51Testing软件测试网5r)h
n!L"[q+A
find ./ -type f -size +1G51Testing软件测试网4oN
E*gs9r2Ee:f
51Testing软件测试网 ~jmPCD[EW
Xn dj7Lbv0延伸,51Testing软件测试网6Q8oubP zJ
\
y7an,tB0# 查找isTester目录下,两层目录内(包含2层子文件夹内的文件),所有大于10M的文件
?S.dlG x2OK+k0find ./isTester -maxdepth 2 -size +10M51Testing软件测试网Ri?
`'@~/m?
*_d.G+E'qkq0
51Testing软件测试网&L(EM!}o M3dcf
51Testing软件测试网GK&tN6l[[
#倒序显示当前路径下,所有大于1M的文件
H6n$^jS0du -sh ./isTester/* |grep M|sort -nr51Testing软件测试网,b0?]fKj!Z
51Testing软件测试网cDt7~3C:x!y(A*L{
51Testing软件测试网Qv+Q1|
w
i"y
w3X
# 查找当前目录下,所有1级空目录,并删除51Testing软件测试网I-EWP;\
find ./ -maxdepth 1 -type d -empty | xargs rm -rf
6[?!\w$x{5gFc0或51Testing软件测试网j|/hgg{
find ./ -maxdepth 1 -type d -empty -exec rm -rf {} \;
j(x%?UuS0
51Testing软件测试网`
{'hU Hx#?'s
51Testing软件测试网h%Fn6[3K7f8r
p
51Testing软件测试网 PiE+B7Nd {
#查找isTester目录下,所有的jpg文件,并压缩为isTester_images.tar.gz
.m#\xH7J1j)]0find ./isTester -type f -name "*.jpg" | xargs tar -czvf isTester_images.tar.gz
+c}.bG9y0
51Testing软件测试网~vuM'M{_Z|.B
51Testing软件测试网3ho)C!t*?z$^2~:R
#查找isTester目录下,所有的log文件,并复制到当前的idoxu目录51Testing软件测试网~3rAD zIF"^
find ./isTester -type f -name "*.log" -exec cp -rf {} idoxu/ \;51Testing软件测试网9l6z0~2x
J |v z5u
S
V'v%g6Mg;xZ2Q0
51Testing软件测试网7h8Ms'V*ZJZ0J*c#H
# 查找包含xx内容的,所有xx文件
6]
P:`/PZgx:l
pPRA0find ./* -name 'config.xml' | xargs grep "isTester"
2?@5Q
hx4N6FJ0
51Testing软件测试网'_hD'a%{"XF4vXK
I\"w7^n'|5W!a8[0
在/root/isTester目录下查找更改时间在5日以内的文件
G5OsHE7D0find /root/isTester/ -mtime -5
b K"}:^"@G%^f^0在/root/isTester目录下查找更改时间在3日以前的文件
9UX,D"j?U CTN0find /root/isTester/ -mtime +351Testing软件测试网hhc!w K
51Testing软件测试网Z
V'i B#yY%M;e
\ DwL%g y!{051Testing软件测试网H8}
til%El
;}%T
]&Q(J1ehg0作者:IDO老徐51Testing软件测试网9^2f(Ik[hH"h
原文链接http://istester.com/linux/312.html51Testing软件测试网_.w]X+|d6w |*HBd'K