← 返回命令列表

Linux command

ncdu 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Analyze disk usage

ncdu

Analyze specific directory

ncdu [/path/to/directory]

Analyze and exclude pattern

ncdu --exclude [*.log]

Scan in quiet mode

ncdu -q [/path/to/directory]

Export scan results

ncdu -o [scan.json] [/path/to/directory]

Load scan results

ncdu -f [scan.json]

Enable file deletion

ncdu [/path] && ncdu

Scan as root

sudo ncdu /

说明

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.

参数

-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).

FAQ

What is the ncdu command used for?

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.

How do I run a basic ncdu example?

Run `ncdu` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -q do in ncdu?

Quiet mode, no scanning progress.