ncdu — NCurses Disk Usage — is du with an interface. The question "what is eating this disk?" becomes an interactive drill-down: arrow keys move, enter descends, d deletes, and the biggest directories sort themselves to the top. It is the rare tool that is both faster to use and easier to learn than its classic counterpart.
The drill-down #
$ ncdu ~
The listing sorts by size, largest first, with a relative bar beside each entry. You follow the numbers down: 54G total, 18G projects, 12G .cache — three keystrokes to the culprit, where the du-plus-sort pipeline needs a command per level.
Deleting happens inside the tool — d on an entry, confirm, done. Every deletion is explicit; ncdu never removes anything you did not point at.
The flags worth knowing #
| Flag | Effect |
|---|---|
-r | Read-only mode: browse without delete keys |
-x | Stay on one filesystem (skip mounted drives) |
-e | Show extended info including permissions |
-o file | Export a scan to analyse later |
-f file | Import a previous export |
-x matters on home directories full of bind mounts and network shares — you scan what you meant to scan. The export/import pair is quietly excellent for servers: scan once (as root, over ssh), then browse the dump locally without re-walking the tree:
$ ssh server 'ncdu -o - /var' > server-var.ncdu
$ ncdu -f server-var.ncdu
Where it sits in the workflow #
The full diagnostic stack, in order:
- df -h — is the filesystem actually full?
- ncdu — which directory is responsible?
- rm or archive — the rm habits apply, just with better aim.
Cleaning up what ncdu finds safely is rm territory; archiving instead of deleting is tar. The terminal notes series continues on the journal.
