綠色資源網:您身邊最放心的安全下載站(zhàn)! 最新軟件|熱門排行(háng)|軟件分類|軟件專題|廠商大(dà)全

綠色資源網

技術(shù)教程(chéng)
您的位置:首頁(yè)操作係統linux → Linux查看所(suǒ)有子文件夾及文(wén)件的數量(liàng)

Linux查(chá)看所有子文件夾(jiá)及文件的數量

我要評論 2012/09/26 11:31:56 來源:綠色資源網 編輯:www.ynaad.com [ ] 評論:0 點擊:249次

find命令查看(推薦):

所有子(zǐ)目錄的數量:

[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 --輸出(chū)結果首行
[root@localhost ~]# find xkermulu/* -type d | more
xkermulu/examples --輸出結果首行

總結:使(shǐ)用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

tree命令查看(kàn)(不推薦):

[root@localhost ~]# tree xkermulu
……
124 directories, 984 files
-----------------------------------------
[root@localhost ~]# tree xkermulu/
……
124 directories, 984 files

du命(mìng)令查看:

[root@localhost ~]# du -ah xkermulu/* | wc -l
1111

總結:du查看的結果為1111,子目錄的數量為124,文件數量為:1111-124=987,所以tree命令查看的(de)結果應該是不準確,至於少計算了哪個文件,沒再查這個問題(tí),推薦使用find命令查看(kàn)。

關鍵詞:Linux

閱讀(dú)本文(wén)後您有什麽感想? 已有 人給出評價!

  • 0 歡迎喜歡
  • 0 白癡
  • 0 拜(bài)托(tuō)
  • 0 哇
  • 0 加油
  • 0 鄙視
免费人欧美成又黄又爽的视频丨一本色道久久88综合日韩精品丨国产专区日韩精品欧美色丨午夜无遮挡男女啪啪视频丨国产欧美日韩综合精品一区二区丨亚洲精品无码不卡在线播HE丨亚洲精品国产精品国自产观看丨日韩国产高清av不卡