← 返回命令列表

Linux command

gdu 命令

文本

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

常用示例

Analyze disk usage

gdu

Analyze a specific directory

gdu [/path/to/directory]

Analyze without interactive mode

gdu -n [/path/to/directory]

Show apparent size

gdu -a [/path/to/directory]

Analyze ignoring specific directories

gdu -i "[.git,node_modules]" [/path]

Export results to JSON

gdu -o json [/path] > [output.json]

Analyze specific filesystem only

gdu -x [/]

Show version information

gdu -v

说明

gdu (go disk usage) is a fast disk usage analyzer with an interactive ncurses interface. Written in Go, it significantly outperforms traditional tools like du and ncdu when analyzing large directory structures. The interactive interface shows directories sorted by size, with usage bars and file counts. Navigation uses arrow keys or vim-style hjkl. Press d to delete selected items, Enter to navigate into directories, ? for help. Color coding indicates directory types: blue for directories, red for large files, special colors for symlinks, sockets, etc. The progress indicator shows scanning status and estimated completion. Non-interactive mode (-n) outputs results suitable for scripting. JSON export enables integration with other tools or storing analysis results for later comparison. The tool can also read back exported JSON files for viewing without rescanning. Performance comes from parallel scanning and efficient memory usage. It's particularly effective on SSDs and NVMe drives where I/O isn't the bottleneck.

参数

-n, --non-interactive
Run in non-interactive mode (just print results).
-a, --apparent-size
Show apparent file size instead of disk usage.
-x, --no-cross
Don't cross filesystem boundaries.
-i, --ignore-dirs _paths_
Comma-separated paths to ignore.
-I, --ignore-dirs-pattern _regex_
Ignore paths matching the given regular expression.
-m, --max-cores _n_
Set the maximum number of CPU cores to use.
-o, --output-file _file_
Export results to a file (use with format flag).
-f, --input-file _file_
Read from exported JSON file instead of scanning.
-c, --no-color
Disable color output.
-d, --show-disks
Show all mounted disks.
-p, --no-progress
Don't show progress during scan.
-s, --summarize
Show only a total for each argument.
-L, --follow-symlinks
Follow file symbolic links.
--top _n_
Show only the top N largest files.
--si
Use SI units (powers of 1000) instead of binary.
-v, --version
Show version information.

FAQ

What is the gdu command used for?

gdu (go disk usage) is a fast disk usage analyzer with an interactive ncurses interface. Written in Go, it significantly outperforms traditional tools like du and ncdu when analyzing large directory structures. The interactive interface shows directories sorted by size, with usage bars and file counts. Navigation uses arrow keys or vim-style hjkl. Press d to delete selected items, Enter to navigate into directories, ? for help. Color coding indicates directory types: blue for directories, red for large files, special colors for symlinks, sockets, etc. The progress indicator shows scanning status and estimated completion. Non-interactive mode (-n) outputs results suitable for scripting. JSON export enables integration with other tools or storing analysis results for later comparison. The tool can also read back exported JSON files for viewing without rescanning. Performance comes from parallel scanning and efficient memory usage. It's particularly effective on SSDs and NVMe drives where I/O isn't the bottleneck.

How do I run a basic gdu example?

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

What does -n, --non-interactive do in gdu?

Run in non-interactive mode (just print results).