How to Use the dust Command in Linux for a Visual Tree of Disk Usage

Monitoring storage space in Linux traditionally relies on the standard du (disk usage) command. While du is versatile, its text-heavy output can be tedious to parse when searching for oversized files and nested directories. The dust utility (often invoked as dust) is a modern, Rust-based alternative that visualises storage consumption as an intuitive, proportional terminal tree.

Key Advantages of Using dust Over Traditional du

Compared to legacy command-line tools, dust introduces several quality-of-life enhancements for systems administrators and developers:

  • Proportional Visual Bars: Displays coloured, percentage-based visual bars next to each directory, instantly identifying storage bottlenecks.
  • Smart Tree Ordering: Automatically sorts entries by disk consumption from largest to smallest, placing the heaviest culprits at the bottom near your prompt.
  • Terminal Height Awareness: Automatically truncates minor subdirectories so the overall report fits neatly within your active terminal window height.
  • Filesystem Respect: By default, ignores hidden files or allows quick filtering of specific file extensions and cross-filesystem mount points.

Installing dust Across Popular Linux Distributions

The dust binary is packaged across standard software repositories and containerised package formats:

  • Ubuntu, Debian, and Linux Mint:
    sudo apt install du-dust
    Note: On some Debian derivatives, the binary is named dust or du-dust to prevent collisions with existing legacy scripts.
  • Fedora and Red Hat Enterprise Linux:
    sudo dnf install dust
  • Arch Linux and Manjaro:
    sudo pacman -S dust
  • Cargo (Universal Rust Installation):
    cargo install du-dust

Common dust Commands and Daily Usage Examples

Running dust without extra flags analyses the current working directory and outputs an easy-to-read hierarchy. You can refine this scan with several practical parameters:

1. Scanning a Target Directory

To inspect a specific directory, such as /var/log or /home/user, pass the path directly:

dust /var/log

2. Limiting Tree Depth and Line Count

If a filesystem contains hundreds of nested folders, limit the depth or maximum display lines:

dust -d 2 /home/user

The -d 2 flag restricts the inspection tree to two directory levels deep, maintaining clarity.

3. Showing Apparent File Size

By default, dust reports actual allocated disk blocks. To view uncompressed or apparent file byte sizes, supply the -s option:

dust -s /var/www

4. Filtering by Specific File Extensions

To pinpoint space taken by specific media or database extensions, use the -e flag:

dust -e mp4,iso,tar.gz ~/Downloads

5. Excluding Specific Patterns and Hidden Files

Ignore .git directories or node dependencies to speed up filesystem traversal:

dust -X node_modules -X .git /workspace

Recommended Aliases for Fast Storage Diagnostics

To integrate dust smoothly into your everyday bash or zsh workflow, add a custom alias to your shell configuration file (~/.bashrc or ~/.zshrc):

alias dtree="dust -r -d 3"

Reload your shell with source ~/.bashrc. Typing dtree will now output an inverted, cleanly proportioned three-tier directory map whenever storage space drops low.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.