dua — Disk Usage Analyzer with Interactive Terminal UI
dua is a parallelized disk usage analyzer in Rust with an interactive TUI that lets you delete files without leaving the tool, scanning 10× faster than du on modern NVMe drives.
What it is
dua (Disk Usage Analyzer) is an open-source CLI tool written in Rust that scans directories in parallel and displays file sizes in an interactive terminal interface. Unlike the traditional du command, dua uses all CPU cores via rayon to achieve significantly faster scan times, especially on NVMe drives.
It is designed for developers, sysadmins, and anyone who needs to reclaim disk space quickly without switching between multiple tools. The interactive TUI lets you navigate the file tree, mark directories for deletion, and execute deletions without leaving the tool.
How it saves time or tokens
dua replaces the common du -sh * | sort -h | head plus rm -rf workflow with a single interactive session. By parallelizing the filesystem walk, dua can scan directories up to 10x faster than traditional du on modern hardware. The integrated delete functionality means you never context-switch to another shell to remove files -- you mark and confirm directly in the TUI.
For CI/CD pipelines or scripts, dua also supports non-interactive mode with machine-readable JSON output, eliminating the need to parse human-formatted text.
How to use
- Install dua via your package manager:
brew install dua-clion macOS,cargo install dua-clifor Rust users, or download binaries from the GitHub releases page. - Run
dua ~/Downloadsfor a quick non-interactive summary of top-level directory sizes. - Run
dua interactive ~/Projectsto launch the TUI, navigate with arrow keys, pressdto mark items for deletion, andSpaceto confirm.
Example
# Install
brew install dua-cli
# Non-interactive: show top-level sizes
dua ~/Downloads
# Interactive TUI: navigate and delete
dua interactive ~/Projects
# Limit CPU usage
DUA_CPUS=4 dua interactive /var/log
# JSON output for scripting
dua --format json ~/data
Related on TokRepo
- Automation tools -- other CLI tools that streamline developer workflows
- DevOps tools -- infrastructure and operations utilities
Common pitfalls
- Running dua on network-mounted filesystems (NFS, SMB) may not benefit from parallelism and can saturate network bandwidth.
- The delete feature is permanent and does not use a trash/recycle bin -- double-check before confirming marked items.
- On Linux, dua reports apparent size by default; use
--apparent-sizeor--count hard-linksflags to matchdubehavior for hard-linked files.
Frequently Asked Questions
dua and ncdu both provide interactive disk usage browsing, but dua scans in parallel across multiple CPU cores while ncdu is single-threaded. On modern NVMe drives with many files, dua can finish scanning significantly faster. dua also supports JSON output for scripting.
Yes. In interactive mode, press d to mark files or directories for deletion, then press Space to confirm. The deletion is permanent and bypasses the system trash, so review your selections carefully before confirming.
dua runs on Linux, macOS, and Windows. It is available via Homebrew, Cargo, apt, dnf, scoop, and as pre-built binaries from GitHub releases.
dua is hard-link-aware and can deduplicate hard-linked files when calculating real disk usage. Use the --count hard-links flag to see accurate sizes when your filesystem uses hard links extensively.
Yes. Set the DUA_CPUS environment variable to control the number of worker threads. For example, DUA_CPUS=4 limits dua to four threads, which is useful when you want to avoid saturating CPU on a shared server.
Citations (3)
- dua GitHub Repository— dua is a parallelized disk usage analyzer written in Rust
- dua README— Uses rayon for parallel filesystem walking
- Rust CLI Working Group— Rust ecosystem for CLI tools
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.