LinuxCommandLibrary

dutree

List directory contents with disk usage

TLDR

Show a graphical tree of the current directory

$ dutree
copy

Show a specific directory
$ dutree [path/to/directory]
copy

Aggregate items smaller than a number of KB (or M for MB, or G for GB)
$ dutree --aggr [number]K
copy

Show subdirectories up to the specified depth (default is 1)
$ dutree --depth [depth]
copy

Skip directories for a fast local overview
$ dutree --files-only
copy

Exclude hidden files
$ dutree --no-hidden
copy

SYNOPSIS

dutree [OPTIONS] [PATH]...

PARAMETERS

-a, --all
    Show all files, not only directories

-d , --depth
    Limit max display depth (default: unlimited)

-h, --human
    Human-readable sizes (KiB, MiB, GiB)

--si
    Use SI units (kB, MB, GB) instead of IEC

-c , --color
    WHEN: always|never|auto (default: auto)

-s , --sort
    Sort by KEY: size|name|rate (default: size)

--reverse
    Reverse sort order

-H, --no-dereference
    Do not follow symlinks

--threads
    Use NUM threads (default: CPU cores)

-j, --json
    Output JSON instead of tree

-f , --file
    Read paths from FILE, one per line

-V, --version
    Print version info

--help
    Print help

DESCRIPTION

Dutree is a Rust-based command-line tool that visualizes disk usage in a compact, interactive tree format directly in the terminal. Unlike traditional du, it presents directories and files hierarchically with bar charts proportional to size, making it easy to spot space hogs at a glance.

Key features include customizable depth limits, sorting by size/name/rate, human-readable output (KiB/MiB or SI units), colorization, and support for multi-threading to scan large filesystems quickly. It handles symlinks optionally and can read paths from files or output JSON for scripting.

Ideal for quick analysis without leaving the CLI, dutree is faster and more intuitive than ncdu for non-interactive use, combining du's accuracy with tree's visualization. Install via cargo (cargo install dutree) or package managers on Linux/macOS.

CAVEATS

May consume high memory on massive directories; no interactive navigation like ncdu; requires Rust toolchain or package for install.

EXAMPLES

dutree /home   Tree of home dir.
dutree -h -d 3 --sort size ~   Human sizes, depth 3, size-sorted.
dutree -j /var > usage.json   JSON export.

INSTALLATION

Linux: cargo install dutree or apt install dutree (some distros). macOS: brew install dutree. Source: GitHub arthursens/dutree.

HISTORY

Developed by Arthur Sens in Rust (2018); initial GitHub release v0.1.0. Evolved with threading, JSON output in v0.2+; active maintenance, v0.20+ as of 2024. Focuses on speed/portability over C tools.

SEE ALSO

du(1), ncdu(1), tree(1), dust(1)

Copied to clipboard