IDO老徐,在深圳,某上市公司质量部负责人,干了十二年软件测试,公号"简尚" ,博客isTester.com ,关注「软件测试从业者综合能力提升」,微信957863300

Linux下常用的查找命令,提升效率

上一篇 / 下一篇  2019-10-10 14:32:52 / 个人分类:linux

51Testing软件测试网1L]:}(UFy8P?#|4MT h

前置条件

rk y0N0{0

51Testing软件测试网k"} X:Jzl1C4Xj

创建一个1G的文件

c/O\fwGu1Mh0

fallocate -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(`Ed0

find ./ -type f -size +100M51Testing软件测试网1zKZ M Wo


51Testing软件测试网G+D?@W[m]


51Testing软件测试网4P4pZXIjN

大于1G51Testing软件测试网Zx#BN v A8~C7kn}


0Y0mX nN5oY%@P0

find ./ -type f -size +1G51Testing软件测试网"Wk'?$` J+m3duL


51Testing软件测试网!s!@} d,j#XM


51Testing软件测试网{-L$W(Wo w u

延伸,51Testing软件测试网T u!Qp X|MH8K S

!\{F6j8y?7C0

查找isTester目录下,两层目录内(包含2层子文件夹内的文件),所有大于10M的文件

Z+C-W9K,J!Hi s'q UP0

find ./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-Rw(z:Yi

du -sh ./isTester/* |grep M|sort -nr51Testing软件测试网$`9d4H7X"I:m'is|


51Testing软件测试网oh0yNq\[6ZE


!~+t'?z7M0

查找当前目录下,所有1级空目录,并删除

t-l(PhM)~g0

find ./ -maxdepth 1  -type d -empty | xargs rm -rf

~:Z |Z#d0

jmF}6T/M&OzP0

find ./ -maxdepth 1  -type d -empty -exec rm -rf {} \;

%JU*E1VHu|t0


51Testing软件测试网gp?Z;bl)[)n


51Testing软件测试网R&h4@P9CD!?@

E#d&r%}-E4cX0

#查找isTester目录下,所有的jpg文件,并压缩为isTester_images.tar.gz

.mf[2qB&P7P0

find ./isTester -type f -name "*.jpg" | xargs tar -czvf isTester_images.tar.gz51Testing软件测试网uM(rhu


!v y4euI0


7V#I]\Cv gs!K} I0

#查找isTester目录下,所有的log文件,并复制到当前的idoxu目录

9B.[%|(pG ?r%sdg0

find ./isTester -type f -name "*.log" -exec cp -rf {} idoxu/ \;

9CI/Q:s~-FQ5D:~(V0


51Testing软件测试网r+Gy~V


51Testing软件测试网*\3o#QJ"sgq

查找包含xx内容的,所有xx文件

%Fqm0Q d+i|A f({2h0

find ./* -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:t0

find /root/isTester/ -mtime -551Testing软件测试网$M*AH8ScN|)Y

在/root/isTester目录下查找更改时间在3日以前的文件


S8m | S7U0

find /root/isTester/ -mtime +351Testing软件测试网"e:o2MM"LJ_7SP.D

51Testing软件测试网Hnsw"m&~_ D
51Testing软件测试网i%| iJ V x)g,t)@:O


_2Jn9]pv'AR-L0
51Testing软件测试网+bg)O|0Z

作者:IDO老徐51Testing软件测试网B$W*l+f-R;g0q

原文链接http://istester.com/linux/312.html

%o5Rc3q Q0

TAG:

 

评分:0

我来说两句

xuquan

xuquan

IDO老徐,坐标深圳,测试经理,干了十年测试,公号"简尚" ,个人博客isTester.com ,关注「软件测试从业者综合能力提升」,微信957863300

日历

« 2023-12-06  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 897722
  • 日志数: 427
  • 建立时间: 2012-06-04
  • 更新时间: 2022-02-23

RSS订阅

Open Toolbar