🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

ncdu Command

Beginner Disk & Storage man(1)

Interactive disk usage analyzer with ncurses interface

👁 8 views 📅 Updated: Mar 15, 2026
SYNTAX
ncdu [OPTION]... [DIRECTORY]

What Does ncdu Do?

ncdu (NCurses Disk Usage) is an interactive disk usage analyzer with a text-based UI. It scans directories and presents results in a navigable, sorted view, making it easy to find and clean up large files and directories.

ncdu is far more efficient than running du repeatedly. It scans once and lets you browse interactively, drill into subdirectories, and even delete files directly from the interface.

ncdu is the best tool for disk cleanup — it shows you exactly what is consuming space, lets you navigate the hierarchy, and provides instant deletion of unnecessary files.

Options & Flags

OptionDescriptionExample
-q Quiet mode (no refresh during scan) ncdu -q /
-x Stay on same filesystem ncdu -x /
-e Enable shell extension (delete files) ncdu -e /var/
-o Export scan results to file ncdu -o scan.json /
-f Load previously saved scan ncdu -f scan.json
--exclude Exclude pattern ncdu --exclude='*.log' /var/

Practical Examples

#1 Scan and explore

Scans the root filesystem and opens interactive browser.
$ ncdu /

#2 Stay on one filesystem

Scans only the root filesystem, excluding mounted drives.
$ ncdu -x /

#3 Scan specific directory

Scans and shows usage for the log directory.
$ ncdu /var/log

#4 Export scan

Saves scan results to a file for later viewing.
$ ncdu -o /tmp/scan.json /home/

#5 Load saved scan

Opens a previously saved scan without re-scanning.
$ ncdu -f /tmp/scan.json

#6 Remote server scan

Scans a remote server and views results locally.
$ ssh server "ncdu -o- /" | ncdu -f-

Tips & Best Practices

Navigation keys: Arrows to navigate, Enter to enter directory, d to delete, n to sort by name, s to sort by size, q to quit.
Export for remote servers: Scan a server and save results: ncdu -o- / | gzip > scan.gz. View locally: zcat scan.gz | ncdu -f-
Not always installed: ncdu is not installed by default. Install with: apt install ncdu, yum install ncdu, or brew install ncdu.

Frequently Asked Questions

How do I use ncdu?
Run ncdu /path to scan. Navigate with arrow keys, Enter to drill down, d to delete, q to quit.
How do I install ncdu?
apt install ncdu (Debian/Ubuntu), yum install ncdu (RHEL), brew install ncdu (macOS).
How is ncdu different from du?
ncdu provides an interactive, navigable interface. du gives text output. ncdu is much better for exploring and cleaning up disk space.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →