Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
fzinfz
V2EX  ›  Linux

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

  •  
  •   fzinfz ·
    fzinfz · Aug 10, 2016 · 3688 views
    This topic created in 3584 days ago, the information mentioned may be changed or developed.

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

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

    如何复现:

    1. 安装 anaconda
    2. conda create --name py35 --clone root
    3 replies    2016-08-10 19:03:05 +08:00
    metrue
        1
    metrue  
       Aug 10, 2016 via Android
    有一种东西叫 man
    fzinfz
        2
    fzinfz  
    OP
       Aug 10, 2016
    @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
       Aug 10, 2016
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1332 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 17:22 · PVG 01:22 · LAX 10:22 · JFK 13:22
    ♥ Do have faith in what you're doing.