Ncdu: a great tool for tracking down where disk space is going

In a recent post, we discussed how much space is required for a Yocto build. The du command can be used, but I find this tedious as you need to run it at one level, and then again at the next level down. ncdu appears to be an excellent solution to this problem.

  • reasonably fast
  • shows you the size of the data scanned, so you have some idea of the progress
  • sorts directories and shows a bar graph of usage so you can quickly identify the big ones
  • can drill down into subdirectories without re-scanning
  • can delete directories right in the tool

Below are some screenshots of my Yoe build dir:

And, it is written in Zig.

Out of curiosity, I checked out the source and built it on my Arch workstation:

image

It is not blazing fast to compile like Go, but it did compile and run with no fuss. I think Zig is making progress …

Does it build a static binary ? I know it uses musl internally for its standard library and links pieces statically as needed. really slick.

In Arch feeds:

[cbrake@ceres ~]$ ldd /usr/bin/ncdu
        linux-vdso.so.1 (0x00007ffe33d5f000)
        libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007f783de56000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f783de51000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f783dc67000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f783df99000)

The one I built:

[cbrake@ceres zig-out]$ ldd bin/ncdu 
        linux-vdso.so.1 (0x00007ffd293af000)
        libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007fac908de000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fac906f4000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fac90957000)

I wonder if libpthread brings in libc?

yeah its building with shared libs I guess.