Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

93.4. ncdu-2.11.1

Disk usage analyser with an ncurses interface

2.11.1-2 · MIT · 4.0 SBU · 787.3 KiB, 5 files · 41_system, 502 of 1047 · ports/core/files/ncdu

Homepage: https://github.com/BratishkaErik/ncdu

ncdu shows which directories fill a disk, in a browsable ncurses view. It is written in Zig, and the port builds it with zig, linking ncurses and zstd from the system. ncdudep-translate_c and ncdudep-aro are the two Zig packages its build.zig fetches; the recipe unpacks them where zig build --system looks, so the build uses no network.

Depends on: zig, ncurses, zstd.

Required by: no port names it.

Sources: ncdu-2.11.1.tar.gz (80.6 KiB), ncdudep-translate_c.tar.gz (150.9 KiB), ncdudep-aro.tar.gz (956.5 KiB). Every step kpkg takes applies to this port.

Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install ncdu'

build.sh:

export ZIG_GLOBAL_CACHE_DIR="$SRC_ROOT/zig-cache"
mkdir -p "$ZIG_GLOBAL_CACHE_DIR/p"

unpack_zig_dep() {
	mkdir -p "$ZIG_GLOBAL_CACHE_DIR/p/$2"
	tar xf "$PORT_SRC/ncdudep-$1.tar.gz" --strip-components=1 \
		-C "$ZIG_GLOBAL_CACHE_DIR/p/$2"
}
unpack_zig_dep translate_c translate_c-0.0.0-Q_BUWgpXBwDWbTJQO9Ul01ZN4NJ4CEqQ4ZX1vLrcy38W
unpack_zig_dep aro         aro-0.0.0-JSD1QrExOgBF8ySFOvEaZfP1LBTjgwg58Y7UHoGJ3nOd

unset PKG_CONFIG_PATH
zig build --system "$ZIG_GLOBAL_CACHE_DIR/p" -fsys=ncurses -fsys=zstd \
	-Doptimize=ReleaseFast -Dcpu=baseline -Dpie=true \
	--prefix "$PKG/usr"
strip --strip-debug "$PKG/usr/bin/ncdu"
install -Dm644 ncdu.1 "$PKG/usr/share/man/man1/ncdu.1"

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/ncdu.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Disk Usage
GenericName=Disk Usage Analyser
Comment=Find what is filling the disk
Exec=ncdu
Icon=drive-harddisk
Terminal=true
Categories=System;Filesystem;
Keywords=disk;usage;space;du;ncdu;
EOF
chmod 644 "$PKG/usr/share/applications/ncdu.desktop"

Programs: ncdu.

Directories: /usr/share/licenses/ncdu.