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.
Ready-to-run agent install
This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.
npx -y tokrepo@latest install bccf74e7-389d-11f1-9bc6-00163e2b0d79 --target codexRun after dry-run confirms the install plan.
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
gdu — Pretty Fast Disk Usage Analyzer Written in Go
gdu is a parallel disk usage analyzer in Go inspired by ncdu, optimized for SSDs, with an interactive TUI, non-interactive mode for CI, and static-binary portability.
duf — Disk Usage/Free Utility Made Beautiful
duf replaces the classic `df` command with a colorful, human-readable table showing disk usage across all your mounts. Better ergonomics, clearer layout, and zero learning curve.
nnn — n³ The Fastest Terminal File Manager Ever Written
nnn is a full-featured, ultra-fast, zero-config terminal file manager written in C, with a plugin ecosystem, type-to-nav, mounting, disk usage analysis, and batch renaming.
dust — A More Intuitive Version of du in Rust
dust (du + Rust = dust) is a modern replacement for the du disk usage command. It provides a visual, color-coded tree view of directory sizes, instantly showing which folders and files consume the most disk space.