[英]How can I make the “du” command run without outputting all the directories, like quiet mode?
[英]linux command line: du --- how to make it show only total for each directories
我正在這樣做(使用 coreutils_8.5-1ubuntu6_amd64):
du -sch `find ./ -maxdepth 1 -type d`
我正在尋找一種簡單的方法(較短的 cmd)來查找子目錄的大小。 謝謝你。
這適用於 coreutils 5.97:
du -cksh *
在我的 du 版本(來自 coreutils 8.14)上,這有效:
du -h -d 1
-h 用於人類可讀的大小。
以下為我完成了工作:
du -hs */
沒有尾部斜杠,output 不限於目錄。
這個命令就是你的答案:
du -sh *
其實你可以試試:
du -kh | cut -f1
創建別名:
alias subs="du -sch `find ./ -maxdepth 1 -type d`"
我認為“潛艇”要短得多。
不確定 coreutils,但我喜歡df -h <directory>
或df -h
。 -h 用於人類可讀。
所有這些答案對我都不起作用,我認為某些參數取決於環境。
所以我這樣做了:
du -csh /home/pi/walala/* | grep total | sed 's/ *\stotal* *\(.*\)/\1/'
或字節
du -csb /home/pi/walala/* | grep total | sed 's/ *\stotal* *\(.*\)/\1/'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.