![](/img/trans.png)
[英]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.