老男人百科 > 百科 > 正文

linux查看所有文件及子目录文件(linux怎么查看所有文件夹)

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
揭开青春期遗精的秘密(遗精出现在青春期)
裸睡的危害有哪些(我和室友裸睡互摸)

裸睡的危害有哪些(我和室友裸睡互摸)

hao333 9693次阅读2023-01-31 19:36
青少年性冲动是生存本能(青少年性冲动的表现形式是)
晨勃减退是什么原因(晨勃减退是什么原因)
专题页