Skip to content

ncdu

Scans a directory tree and lets you browse it sorted by size, in a terminal.

Homebrew formula

What it does

ncdu scans a path, then presents it as an interactive list sorted largest-first. Arrow keys navigate in and out, d deletes, and the totals update. It runs over SSH, which is what makes it the right tool for a full disk on a headless server.

ncdu /
ncdu -x /              # stay on one filesystem
ncdu -o scan.json /    # save a scan
ncdu -f scan.json      # browse it later

Notes

sudo is needed to see other users’ and system directories. -x is almost always wanted on macOS, otherwise it wanders into mounted volumes and network shares.

Alternative to

AlternativeTypeTrade-off
dustOpen sourceA friendlier du with a bar chart, no interactive browsing
gduOpen sourceConsiderably faster on SSDs, same interface idea
dua-cliOpen sourceParallel scanning with an interactive mode
du -sh * | sort -hBuilt inNo install, and enough surprisingly often

Install

brew install ncdu

Links

This post is licensed under CC BY 4.0 by the author.
Last updated on