When a Linux server or desktop workstation runs low on storage space, finding which directories or nested subfolders are consuming gigabytes of disk space is traditionally accomplished using the standard du (disk usage) command. However, running du -sh * | sort -h produces flat, uninformative lists that require repeated recursive searches into individual subfolders to locate space hogs.
dust (also distributed as du-dust) is an open-source command-line disk analysis tool written in Rust. It takes standard du metrics and presents them as an intuitive, hierarchical ASCII tree diagram complete with proportional graphical percentage bars. It allows system administrators to instantly spot which nested directories are responsible for storage consumption in a single terminal command. This guide covers how to install, configure, and use dust in Linux.
Core Advantages of dust
- Visual Tree Hierarchies: Renders nested folder structures with auto-scaling horizontal percentage bars.
- Largest First Sorting: Automatically displays the largest directories at the bottom of the screen (closest to the prompt) for immediate visibility.
- Intelligent Disk Space Formatting: Displays human-readable sizes (GB, MB, KB) using standard binary prefixes.
- Regex Filtering: Filter out specific directories (such as
.git,node_modules, or cache folders) with simple command flags.
Installing dust on Linux
Method 1: Distribution Package Managers
# Ubuntu / Debian (Ubuntu 23.04+ or modern repos)
sudo apt update && sudo apt install -y du-dust
# Arch Linux
sudo pacman -S dust
# Fedora / CentOS Stream
sudo dnf install -y du-dust
Method 2: Static Pre-Compiled Binary (Universal)
If running an enterprise distribution without native packages:
curl -s https://api.github.com/repos/bootandy/dust/releases/latest | grep "browser_download_url.*x86_64.*linux-musl.tar.gz" | cut -d : -f 2,3 | tr -d \" | wget -qi -
tar -xvf dust-*.tar.gz
sudo mv dust-*/dust /usr/local/bin/
dust -V
Running and Navigating dust
1. Basic Directory Scan
Analyze the current working directory:
dust
Sample output:
Disk Usage:
3.2G ┌── venv
1.8G ├── .cache
4.1G ├── build
8.4G ├── data
│ 3.8G │ └── models
│ 4.6G │ └── datasets
17.5G └── /var/www/app
2. Limiting Tree Depth
To prevent massive nested hierarchies from overwhelming your terminal display, limit recursive depth with the -d flag:
# Show only 2 directory levels deep
dust -d 2 /var/log
3. Limiting Display Rows
Display only the top 10 largest folders consuming storage:
dust -n 10 /home
4. Excluding Unwanted Directories
Exclude temporary build directories or git history:
dust -X node_modules -X .git /projects
Command Options Summary
| Flag | Function | Workflow Benefit |
|---|---|---|
-d <depth> |
Limits recursion depth | Clean high-level overview of disk layout |
-n <count> |
Sets number of displayed rows | Restricts terminal output to largest culprits |
-p |
Full path display | Prints complete absolute directory paths |
-r |
Reverses display order | Renders largest directories at the top of the terminal |
-s |
Apparent size calculation | Calculates exact file bytes rather than allocated disk blocks |