2023-05-15 22:17:34 阅读( 8949)
find命令查看(推荐):所有子目录的数量:[root@localhost~]#findxkermulu-typed|wc-l125[root@localhost~]#findxkermulu/-typed|wc-l125[root@localhost~]#findxkermulu/*-typed|wc-l124--正确结果不同的原因:[root@localhost~]#
查找命令视图(推荐):
所有子目录的数量:
[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-正确
不同结果的原因:
[root@localhost ~]# find xkermulu -type d | more
Xkermulu -输出结果的第一行。
[root@localhost ~]# find xkermulu/* -type d | more
Xkermulu/examples -输出结果的第一行。
总结:使用xkermulu/*不包含xkermulu的父目录,只输出其下的子目录。
所有文件的数量:
[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
树状命令视图(不推荐):
[root@localhost ~]# tree xkermulu
……
124 directories, 984 files
-----------------------------------------
[root@localhost ~]# tree xkermulu/
……
124 directories, 984 files
杜指挥查看:
[root@localhost ~]# du -ah xkermulu/* | wc -l
1111
总结:du查看的结果是1111,子目录数是124,文件数是1111-124=987,所以树形命令查看的结果应该是不准确的。至于哪个档案少算了,问题就不查了。建议使用find命令进行查看。
猜你喜欢
Guessyoulike