How to Install and Use dua-cli in Linux for Fast and Interactive Terminal Disk Space Analysis

Traditional Unix tools like du and ncdu perform disk usage calculations on a single thread. When scanning high-capacity solid-state drives containing millions of small development files (such as node_modules directories or Docker build layers), calculating disk usage can take several minutes. The dua-cli (Disk Usage Analyzer) utility solves this bottleneck by parallelising filesystem traversal across all available CPU cores by default, delivering near-instantaneous directory inspection alongside an interactive terminal interface.

Why dua-cli Outperforms Traditional du and ncdu

Written in Rust, dua-cli focuses on execution speed and ergonomic cleanup:

  • Fully Parallel Traversal: Traverses directory trees across multiple threads, saturating NVMe and SSD read queues to compute directory weights up to ten times faster than single-threaded tools.
  • Interactive Terminal UI: Features an interactive browser mode similar to ncdu, allowing you to drill down into subdirectories using keyboard shortcuts.
  • Instant Deletion: Allows deleting bloated temporary caches and build artifacts directly from the navigation view without opening a separate shell.
  • Minimal Footprint: Ships as a single self-contained binary with zero external runtime dependencies.

Installing dua-cli on Linux

You can install dua-cli through package managers, pre-compiled binaries, or Cargo.

Installing on Arch Linux

Arch Linux provides dua-cli directly in the official extra repository:

sudo pacman -S dua-cli

Installing on Ubuntu, Debian, and Linux Mint

Download the pre-compiled static binary from GitHub releases:

DUA_VERSION=$(curl -s https://api.github.com/repos/Byron/dua-cli/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
curl -LO "https://github.com/Byron/dua-cli/releases/download/v${DUA_VERSION}/dua-v${DUA_VERSION}-x86_64-unknown-linux-musl.tar.gz"
tar -xzf "dua-v${DUA_VERSION}-x86_64-unknown-linux-musl.tar.gz"
sudo install -m 755 "dua-v${DUA_VERSION}-x86_64-unknown-linux-musl/dua" /usr/local/bin/
rm -rf "dua-v${DUA_VERSION}-x86_64-unknown-linux-musl"*

Installing via Cargo

If you have Rust installed:

cargo install dua-cli

Running Fast Non-Interactive Summaries

To view a formatted summary of space consumption across top-level directories:

dua /var

This command traverses /var concurrently and prints a clean, human-readable summary sorted by size in ascending or descending order.

Using the Interactive Terminal User Interface (TUI)

To inspect directories interactively, pass the i (interactive) subcommand:

dua i /home/user

This opens a responsive visual browser displaying folders, byte counts, and visual percentage bars. Navigate the interface using standard keybindings:

  • Use the Up (k) and Down (j) arrow keys to highlight directories.
  • Press Enter (l) to drill down into the selected folder.
  • Press Backspace (h) to navigate back up to the parent directory.
  • Press d to mark a highlighted file or directory for deletion, then confirm with y.
  • Press q to exit the interactive mode.

Customising Byte Formatting and Thread Counts

You can adjust display units and concurrency to match specific workstation workloads:

dua -b metric i .

The -b metric flag formats sizes using decimal units (e.g., KB, MB, GB based on 1000 bytes) rather than binary kibibytes (KiB, MiB, GiB based on 1024 bytes), matching modern storage vendor specifications.

Get the best tech tips delivered straight to your inbox.

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