ScriptsApr 15, 2026·2 min read

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.

TL;DR
dua scans disk usage in parallel across CPU cores and provides an interactive TUI for browsing and deleting files.
§01

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.

§02

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.

§03

How to use

  1. Install dua via your package manager: brew install dua-cli on macOS, cargo install dua-cli for Rust users, or download binaries from the GitHub releases page.
  2. Run dua ~/Downloads for a quick non-interactive summary of top-level directory sizes.
  3. Run dua interactive ~/Projects to launch the TUI, navigate with arrow keys, press d to mark items for deletion, and Space to confirm.
§04

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
§05

Related on TokRepo

§06

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-size or --count hard-links flags to match du behavior for hard-linked files.

Frequently Asked Questions

How does dua compare to ncdu?+

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.

Can dua delete files directly?+

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.

What platforms does dua support?+

dua runs on Linux, macOS, and Windows. It is available via Homebrew, Cargo, apt, dnf, scoop, and as pre-built binaries from GitHub releases.

Does dua handle hard links correctly?+

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.

Can I limit CPU usage during a scan?+

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)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets