LinuxCommandLibrary

ncdu

TLDR

Analyze disk usage of current directory

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

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: Navigate
Enter: Enter directory
d: Delete selected item
n: Sort by name
s: Sort by size
C: Sort by count
g: Show percentage/graph
i: Show item info
r: Refresh/recalculate
q: Quit

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)

Copied to clipboard