ncdu

interactive disk usage analyzer with an ncurses interface

TLDR

Analyze disk usage of current directory
$ ncdu
Analyze specific directory
$ ncdu [/path/to/directory]
Analyze and exclude pattern
$ ncdu --exclude [*.log]
Scan in quiet mode (for slow disks)
$ ncdu -q [/path/to/directory]
Export scan results to file
$ ncdu -o [scan.json] [/path/to/directory]
Load scan results from file
$ ncdu -f [scan.json]
Enable file deletion
$ ncdu [/path] && ncdu
Scan as root (for full filesystem)
$ sudo ncdu /

SYNOPSIS

ncdu [options] [path]

DESCRIPTION

ncdu (NCurses Disk Usage) is an interactive disk usage analyzer with an ncurses interface. It scans a directory tree, then presents the results sorted by size, allowing navigation through directories to find space-consuming files.The interface shows directory contents sorted by size with graphical bars indicating relative sizes. Users can navigate using arrow keys, enter directories, and optionally delete files or directories directly.ncdu is particularly useful for identifying large files on servers, cleaning up disk space, and understanding storage usage patterns.

PARAMETERS

-q

Quiet mode, no scanning progress.
-x
Stay on one filesystem.
--exclude pattern
Exclude files matching pattern.
-X file, --exclude-from file
Read exclude patterns from file.
-o file
Export scan results to JSON file.
-f file
Load scan results from file.
-e
Enable shell extension (for exports).
-r
Read-only mode (disable deletion).
--si
Use base 10 (SI) units.
--color scheme
Color scheme (dark, off).

KEYBOARD CONTROLS

Up/Down: NavigateEnter: Enter directoryd: Delete selected itemn: Sort by names: Sort by sizeC: Sort by countg: Show percentage/graphi: Show item infor: Refresh/recalculateq: Quit

INSTALL

sudo apt install ncdu
sudo dnf install ncdu
sudo pacman -S ncdu
sudo apk add ncdu
sudo zypper install ncdu
brew install ncdu
nix profile install nixpkgs#ncdu

CAVEATS

Deletion is permanent and bypasses trash. Scanning large filesystems takes time. File counts may differ from other tools due to hard links. Running without root may skip inaccessible directories.

HISTORY

ncdu was created by Yoran Heling in 2007 as an ncurses-based alternative to du for interactive disk usage analysis. It was designed to address the difficulty of identifying large files using traditional tools. ncdu became a staple system administration tool, and version 2.0 (rewritten in Zig) was released in 2022.

SEE ALSO

du(1), df(1), dust(1), duf(1)