V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
fzinfz
V2EX  ›  Linux

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

  •  
  •   fzinfz ·
    fzinfz · 2016-08-10 16:09:36 +08:00 · 3156 次点击
    这是一个创建于 2813 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    如何复现:

    1. 安装 anaconda
    2. conda create --name py35 --clone root
    3 条回复    2016-08-10 19:03:05 +08:00
    metrue
        1
    metrue  
       2016-08-10 18:47:45 +08:00 via Android
    有一种东西叫 man
    fzinfz
        2
    fzinfz  
    OP
       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
        3
    fzinfz  
    OP
       2016-08-10 19:03:05 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3308 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 12:33 · PVG 20:33 · LAX 05:33 · JFK 08:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.