LinuxCommandLibrary

gdu

Analyze disk space usage

TLDR

Interactively show the disk usage of the current directory

$ gdu
copy

Interactively show the disk usage of a given directory
$ gdu [path/to/directory]
copy

Interactively show the disk usage of all mounted disks
$ gdu --show-disks
copy

Interactively show the disk usage of the current directory but ignore some sub-directories
$ gdu --ignore-dirs [path/to/directory1,path/to/directory2,...]
copy

Ignore paths by regex
$ gdu --ignore-dirs-pattern '[.*[abc]+]'
copy

Ignore hidden directories
$ gdu --no-hidden
copy

Only print the result, do not enter interactive mode
$ gdu --non-interactive [path/to/directory]
copy

Do not show the progress in non-interactive mode (useful in scripts)
$ gdu --no-progress [path/to/directory]
copy

SYNOPSIS

gdu [options] [path]

PARAMETERS

-s, --summarize
    Display only the total size of the current directory, similar to 'du -sh'.

-H, --human-readable
    Use human-readable sizes (e.g., 1K, 234M, 2G) in non-interactive output.

-L, --dereference
    Follow symbolic links during scanning.

-a, --all
    Display all files and directories, not just directories or large files.

-m, --no-mouse
    Disable mouse support in the interactive user interface.

-c, --no-color
    Disable colorized output in the terminal.

-r, --remote-host
    Analyze disk usage on a remote host via SSH. Requires SSH access and 'gdu' on the remote.

-x, --one-file-system
    Skip directories residing on different filesystems.

-i, --ignore-dirs
    Comma-separated list of directory names to ignore during scanning.

-f, --file
    Read directory contents from a 'du'-compatible file instead of scanning the disk.

-h, --help
    Display the help message and exit.

-v, --version
    Print the version information and exit.

DESCRIPTION

gdu (Go Disk Usage) is a modern, blazing-fast, and interactive disk usage analyzer written in Go. It offers an ncurses-like graphical interface for quickly inspecting disk space consumption on Linux/Unix systems.

Designed for efficiency, especially on solid-state drives (SSDs) and filesystems with numerous large directories, gdu leverages parallel processing to scan and report disk usage much quicker than traditional tools like du or even ncdu. Its intuitive interface allows users to easily navigate directory structures, view file and folder sizes, sort entries by various criteria, and even perform direct file or directory deletion operations from within the application, providing a comprehensive and efficient disk management experience.

CAVEATS

Scanning certain system directories (e.g., /root, /proc, /sys) may require sudo or root privileges. The interactive UI requires a compatible terminal emulator. Analyzing remote hosts mandates gdu's presence on the remote system for execution.

INTERACTIVE FEATURES

The gdu interactive UI is highly intuitive. Press h within the application to view a list of keyboard shortcuts for navigation (e.g., j/k for up/down), sorting, showing/hiding percentages (g), and performing actions like deleting files (d) or quitting (q). It provides a real-time, dynamic overview of disk space usage.

PERFORMANCE OPTIMIZATION

gdu is engineered for speed. It utilizes parallel processing to traverse and analyze directories concurrently, significantly reducing scan times compared to single-threaded alternatives. This makes it particularly efficient for large filesystems, network shares, and modern storage devices like SSDs, providing rapid insights into disk consumption.

HISTORY

Developed by Ondřej Dušek (dundee) and written in Go, gdu emerged as a high-performance alternative to existing disk usage analyzers. Its primary motivation was to address the speed limitations of tools like ncdu, especially when dealing with very large filesystems and modern SSDs, by leveraging Go's concurrency features for parallel scanning. It gained popularity for its speed and interactive interface since its initial stable releases around 2019-2020.

SEE ALSO

du(1), ncdu(1), df(1)

Copied to clipboard