LinuxCommandLibrary

dua

Analyze disk usage

TLDR

Analyze specific directory

$ dua [path/to/directory]
copy

Display apparent size instead of disk usage
$ dua --apparent-size
copy

Count hard-linked files each time they are seen
$ dua --count-hard-links
copy

Aggregate the consumed space of one or more directories or files
$ dua aggregate
copy

Launch the terminal user interface
$ dua interactive
copy

Format printing byte counts
$ dua --format [metric|binary|bytes|GB|GiB|MB|MiB]
copy

Use a specific number of threads (defaults to the process number of threads)
$ dua --threads [count]
copy

SYNOPSIS

dua [OPTIONS] [PATH]…

PARAMETERS

-h, --help
    Print help information

-V, --version
    Print version information

--all-files
    Show all files, even those below threshold

--apparent-size
    Use apparent size (stat) instead of disk usage

--by-dir
    Aggregate sizes by directory, not files

--color <WHEN>
    Control color usage: never, auto, always

--exclude <GLOB>
    Exclude files matching shell glob pattern

-f, --format <FORMAT>
    Output format: human, si, bytes, etc.

--git-ignore
    Respect .gitignore and .git/info/exclude

--no-bold
    Disable bold colors in output

--no-progress
    Suppress progress bar

-S, --summarize
    Show only total usage summary

--threshold <SIZE>
    Hide items smaller than SIZE (default: 1M)

--total
    Display grand total at top

DESCRIPTION

dua is a modern, user-friendly command-line tool for analyzing disk usage on Linux and other Unix-like systems. Written in Rust, it provides a full-screen terminal user interface (TUI) by default, allowing interactive navigation through directories sorted by size. Unlike the traditional du command, dua is significantly faster for large filesystems, supports color-coded visualizations, and offers features like gitignore awareness, apparent size reporting, and customizable thresholds.

It scans directories and displays a tree view with percentages, totals, and progress bars. Users can drill down into subdirectories, delete files interactively (with caution), or export data. Non-interactive modes are available for scripting. dua excels at quickly identifying space hogs on servers or desktops, making it popular among developers and sysadmins. Its cross-platform support extends to macOS and Windows via WSL.

CAVEATS

Not installed by default; requires manual installation. Interactive TUI may not work in all terminals. Use --no-tui for plain output if needed.

INSTALLATION

Via Cargo: cargo install dua-cli. Or distro packages: apt install dua-cli, brew install dua.

DEFAULT BEHAVIOR

Launches interactive full-screen TUI. Press ? for keys: up/down navigate, d drill-down, DEL delete.

HISTORY

Developed by Sebastian Thiel starting in 2019 as an open-source Rust project (dua-cli on GitHub). Gained popularity for speed and UX improvements over du. Actively maintained with releases up to v2.30+.

SEE ALSO

du(1), ncdu(1), dust(1), gdu(1)

Copied to clipboard