Linux查看所有子文件夹及文件的数量
find命令查看(推荐):
所有子目录的数量:
[root@localhost ~]# find xkermulu -type d | wc -l
125
[root@localhost ~]# find xkermulu/ -type d | wc -l
125
[root@localhost ~]# find xkermulu/* -type d | wc -l
124 --正确🥃
结果不【jié guǒ bú】同的原🔇因:
[root@localhost ~]# find xkermulu -type d | more
xkermulu --输出结🎊果首行【guǒ shǒu háng】
[root@localhost ~]# find xkermulu/* -type d | more
xkermulu/examples --输出结🎊果首行【guǒ shǒu háng】
总结🏹:使用xkermulu/*不包含xkermulu这个父🌤目录,只输出【zhī shū chū】其下的【qí xià de】🌌子目录【zǐ mù lù】。
所有文件的数量:
[root@localhost ~]# find xkermulu -type f | wc -l
987
[root@localhost ~]# find xkermulu/ -type f | wc -l
987
[root@localhost ~]# find xkermulu/* -type f | wc -l
987
tree命令查看(不推荐):
[root@localhost ~]# tree xkermulu
……
124 directories, 984 files
-----------------------------------------
[root@localhost ~]# tree xkermulu/
……
124 directories, 984 files
du命令查看:
[root@localhost ~]# du -ah xkermulu/* | wc -l
1111
总结💫:du查看的【chá kàn de】结🔹果为【guǒ wéi】1111,子目录🍑的数量【de shù liàng】为124,文件数【wén jiàn shù】量为:1111-124=987,所以tree命令查【mìng lìng chá】看的结🔹果应该🎡是不准确,至于少🔋计算了🙀哪个文件,没再查【méi zài chá】🥜这个问题【tí】,推荐使用【yòng】find命令查【mìng lìng chá】看。
关键词:Linux
阅读本文后您有什么感想? 已有 人给出评价!
- 0
- 0
- 0
- 0
- 0
- 0