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

Running out of disk space on Linux workstations or servers is a common administrative headache. While standard utilities like du and df provide raw storage tallies, analyzing deep directory hierarchies with them often feels slow and cumbersome. Furthermore, standard terminal tools lack interactive deletion controls, requiring you to manually copy paths into rm -rf commands.

dua-cli (invoked simply as dua, which stands for Disk Usage Analyzer) is an exceptionally fast, parallel, and interactive terminal utility written in Rust. Designed to handle millions of files with multithreaded speed, dua lets you explore storage consumption, traverse directories with arrow keys, and safely delete multi-gigabyte build folders in real time. In this guide, explore how to install, configure, and use dua-cli on Linux.

Why Choose dua-cli Over Traditional du or ncdu?

Traditional tools like ncdu (NCurses Disk Usage) are popular, but they operate sequentially on a single thread, causing noticeable delays when parsing massive solid-state drives or enterprise RAID arrays:

Feature Standard du / ncdu dua-cli (dua)
Scanning Architecture Single-threaded directory walking Fully parallelized, multithreaded directory scanner
Performance on SSDs Sequential I/O bottlenecks Maximum throughput across modern NVMe drives
Interactive Terminal UI ncdu only; du has none Interactive terminal user interface (dua i)
Batch File Deletion Requires manual shell scripting or single prompts Integrated multi-selection interactive deletion engine

Installing dua-cli on Linux Distributions

Because dua-cli is developed in Rust, it is distributed across official package repositories, Cargo, and as standalone precompiled binaries:

Method 1: Installing via Native Package Managers

# On Arch Linux
sudo pacman -S dua-cli

# On Alpine Linux
sudo apk add dua-cli

# On Void Linux
sudo xbps-install -S dua-cli

Method 2: Installing Precompiled Binaries from GitHub Releases

For Ubuntu, Debian, CentOS, or Fedora machines without native repository packages, download the static release binary:

# Download the latest Linux x86_64 archive
curl -LO https://github.com/Byron/dua-cli/releases/latest/download/dua-v2.29.3-x86_64-unknown-linux-musl.tar.gz

# Extract the archive
tar -xzf dua-v2.29.3-x86_64-unknown-linux-musl.tar.gz

# Move binary to executable path
sudo mv dua-v2.29.3-x86_64-unknown-linux-musl/dua /usr/local/bin/

# Verify installation and version
dua --version

Method 3: Installing via Cargo

If you maintain a local Rust toolchain:

cargo install dua-cli

Core Command Modes: Aggregate, Top, and Interactive

dua provides multiple command modes depending on whether you want an automated script summary or an interactive cleanup session.

1. Quick Aggregate Tally

To calculate the total disk footprint of specific directories without listing individual files:

dua /var/log /var/cache /home

dua parallelizes the traversal and outputs clean human-readable gigabyte tallies in milliseconds.

2. Interactive Navigation Mode (dua i)

The interactive mode is where dua-cli truly excels. To launch the full-screen terminal visualizer on your current working directory:

dua i

To inspect a system mount point or external drive:

dua i /var

Pro Tip: Launching dua i instantly sorts all subdirectories and files by size descending. A high-contrast progress bar visually highlights the heaviest storage consumers at a glance.

Interactive Keybindings and Navigation

Navigating the interactive interface is fluid and intuitive using standard keyboard controls:

Keybinding Action Performed
↓ or j Move selection down to the next entry
↑ or k Move selection up to the previous entry
→ or Enter or l Open the highlighted folder and descend into its hierarchy
← or h or Esc Ascend to the parent directory
d Mark selected directory or file for deletion (requires confirmation)
Space Toggle multi-selection tag on entries for bulk deletion
? Display built-in keyboard shortcut help overlay
q or Ctrl + C Exit the interactive visualizer

Safely Deleting Bulky Files and Directories

When cleaning out bloated Docker build caches, old virtual environments, or heavy temporary directories, dua-cli prevents accidental data loss:

  1. Highlight the target bloated directory (e.g. node_modules or .cache).
  2. Press d.
  3. dua pauses and prompts: “Really delete node_modules (4.21 GB)? [y/N]”.
  4. Type y and press Enter.

dua executes the deletion in the background, updates directory totals dynamically, and keeps your cursor positioned in the active folder.

Advanced Options and Filtering

Tailor your storage audits using command-line flags:

Ignoring Filesystem Boundaries

By default, dua stays within a single mounted filesystem. If you want to traverse across separate mounts (e.g. crossing root into /mnt or /home on separate partitions):

dua -x i /

Formatting Byte Formats

To force binary units (GiB / MiB) or decimal metric units (GB / MB):

# Force standard binary gigabytes (1024-based)
dua --apparent-size i /data

Streamlining System Storage Maintenance

By combining Rust’s multithreaded I/O efficiency with a responsive terminal interface, dua-cli replaces sluggish legacy disk tools. Integrate dua i into your routine administrative workflow to swiftly reclaim gigabytes of storage across your Linux workstations and production servers.

Get the best tech tips delivered straight to your inbox.

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