du -hs / du -h --max-depth=1 / ncdu 显示的文件夹大小不同?

2016-08-10 16:09:36 +08:00
 fzinfz

同一个 du 运行的结果竟然不同? du -hs / du -h --max-depth=1 有啥区别?

ncdu 子文件夹的大小总和竟然大于 total ?

如何复现:

  1. 安装 anaconda
  2. conda create --name py35 --clone root
3162 次点击
所在节点    Linux
3 条回复
metrue
2016-08-10 18:47:45 +08:00
有一种东西叫 man
fzinfz
2016-08-10 18:57:30 +08:00
@metrue

ncdu 貌似是因为 hard links 的 bug :

BUGS
Directory hard links are not supported. They will not be detected as being hard links, and will thus be scanned and counted multiple times.

du 是为什么么?-d/-s 会影响大小计算?

-d, --max-depth=N
print the total for a directory (or file, with --all) only if it is N or fewer levels below the command
line argument; --max-depth=0 is the same as --summarize

-s, --summarize
display only a total for each argument
fzinfz
2016-08-10 19:03:05 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/298421

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX