Back to rankings

Byron/dua-cli

Rustlib.rs/crates/dua-cli

View disk space usage and delete unwanted data, fast.

diskspace-usecleanerterminal-basedfastefficient
Star Growth
Stars
6k
Forks
159
Weekly Growth
Issues
34
2k4k6k
Jun 2019Oct 2021Mar 2024Jul 2026
Artifactscrates.iocargo add dua-cli
README

Rust Crates.io Packaging status

dua (-> Disk Usage Analyzer) is a tool to conveniently learn about the usage of disk space of a given directory. It's parallel by default and will max out your SSD, providing relevant information as fast as possible. Optionally delete superfluous data, and do so more quickly than rm.

asciicast

Installation

Binary Release

MacOS

curl -LSfs https://raw.githubusercontent.com/Byron/dua-cli/master/ci/install.sh | \
    sh -s -- --git Byron/dua-cli --crate dua --tag v2.29.0

MacOS via MacPorts:

sudo port selfupdate
sudo port install dua-cli

MacOS via Homebrew

brew update
brew install dua-cli

Linux

Linux requires the target to be specified explicitly to obtain the MUSL build.

curl -LSfs https://raw.githubusercontent.com/Byron/dua-cli/master/ci/install.sh | \
    sh -s -- --git Byron/dua-cli --target x86_64-unknown-linux-musl --crate dua --tag v2.29.0

Windows via Scoop

scoop install dua

Windows via WinGet

winget install Byron.dua-cli

Pre-built Binaries

See the releases section for manual installation of a binary, pre-built for many platforms.

Cargo

Via cargo, which can be obtained using rustup

For Unix

cargo install dua-cli

# And if you don't need a terminal user interface (most compatible)
cargo install dua-cli --no-default-features

# Compiles on most platforms, with terminal user interface
cargo install dua-cli --no-default-features --features tui-crossplatform

For Windows, nightly features are currently required.

cargo +nightly install dua-cli

VoidLinux

Via xbps on your VoidLinux system.

xbps-install dua-cli

Fedora

Via dnf on your Fedora system.

sudo dnf install dua-cli

Arch Linux

Via pacman on your ArchLinux system.

sudo pacman -S dua-cli

NixOS

https://search.nixos.org/packages?query=dua

Nix-shell (temporary)

nix-shell -p dua

NixOS configuration

  environment.systemPackages = [
    pkgs.dua
  ];

NetBSD

Via pkgin on your NetBSD system.

pkgin install dua-cli

Or, building from source

cd /usr/pkgsrc/sysutils/dua-cli
make install

Windows

You will find pre-built binaries for Windows in the releases section. Alternatively, install via cargo as in

cargo +nightly install dua-cli

x-cmd

x-cmd is a toolbox for Posix Shell, offering a lightweight package manager built using shell and awk.

x env use dua
  • Additionally, the x dua ... command is available, which automatically installs dua without affecting the environment, such as not modifying the PATH variable.

Usage

# count the space used in the current working directory
dua
# count the space used in all directories that are not hidden
dua *
# learn about additional functionality
dua aggregate --help

Interactive Mode

Launch into interactive mode with the i or interactive subcommand. Get help on keyboard shortcuts with ?. Use this mode to explore, and/or to delete files and directories to release disk space.

Please note that great care has been taken to prevent accidental deletions due to a multi-stage process, which makes this mode viable for exploration.

dua i
dua interactive

The help screen can be localized via the standard POSIX locale environment variables, in the usual order of precedence LC_ALL > LC_MESSAGES > LANG. English is the default; currently Japanese (ja) is also available when the locale uses UTF-8 or omits the codeset:

LANG=ja_JP.UTF-8 dua i   # then press '?' for the Japanese help screen

Configuration

dua can read an optional configuration file from your OS-specific config directory:

  1. Linux/Unix: $XDG_CONFIG_HOME/dua-cli/config.toml (or the platform default config dir)
  2. macOS: ~/Library/Application Support/dua-cli/config.toml
  3. Windows: %APPDATA%\dua-cli\config.toml

If the file is missing, defaults are used.

Currently supported options:

[keys]
# If true, pressing <Esc> in the main pane navigates to the parent directory.
# If true (default), pressing <Esc> in the main pane ascends to the parent directory.
# If false, <Esc> follows the default quit behavior.
esc_navigates_back = true

Development

Please note that all the following assumes a unix system. On Windows, the linux subsystem should do the job.

Run tests

make tests

Learn about other targets

make

But why is…

…there only one available backend? termion was available previously.

Maintaining both backends seemed more cumbersome than it's worth and add complexity I didn't like anymore. termion had its benefits, but I never liked that it seems to have dropped out of support. Thus crossterm is the only remaining backend and it's very actively developed.

Acknowledgements

Thanks to jwalk, all there was left to do is to write a command-line interface. As jwalk matures, dua should benefit instantly.

Limitations

  • Does not show symbolic links at all if no path is provided when invoking dua
    • in an effort to skip symbolic links, for now there are pruned and are not used as a root. Symbolic links will be shown if they are not a traversal root, but will not be followed.
  • Interactive mode only looks good in dark terminals (see this issue)
  • easy fix: file names in main window are not truncated if too large. They are cut off on the right.
  • There are plenty of examples in tests/fixtures which don't render correctly in interactive mode. This can be due to graphemes not interpreted correctly. With Chinese characters for instance, column sizes are not correctly computed, leading to certain columns not being shown. In other cases, the terminal gets things wrong - I use alacritty, and with certain characters it performs worse than, say iTerm3. See https://github.com/minimaxir/big-list-of-naughty-strings/blob/master/blns.txt for the source.
  • In interactive mode, you will need about 60MB of memory for 1 million entries in the graph.
  • In interactive mode, the maximum amount of files is limited to 2^32 - 1 (u32::max_value() - 1) entries.
    • One node is used as to 'virtual' root
    • The actual amount of nodes stored might be lower, as there might be more edges than nodes, which are also limited by a u32 (I guess)
    • The limitation is imposed by the underlying petgraph crate, which declares it as unsafe to use u64 for instance.
    • It's possibly UB when that limit is reached, however, it was never observed either.

Similar Programs

Related repositories
exelban/stats

macOS system monitor in your menu bar

SwiftMIT Licensemacosmonitor
mac-stats.com
40.6k1.4k
giampaolo/psutil

Cross-platform lib for process and system monitoring in Python

PythonPyPIBSD 3-Clause "New" or "Revised" Licensepythonmonitoring
psutil.io
11.2k1.5k
blackboxo/CleanMyWechat

自动删除 Windows 和 Mac 电脑端微信缓存数据,包括从所有聊天中自动下载的大量文件、视频、图片等数据内容,解放你的空间。

PythonPyPIMIT Licensewechatpython
xiaohongshu.com/user/profile/59c0a45651783a05ce64eb00
5.5k415
DO-SAY-GO/dn

💾 dn - offline full-text search and archiving for your Chromium-based browser.

JavaScriptnpmarchiveweb-archive
dosaygo.com/downloadnet
3.9k147
dosyago/dn

💾 dn - offline full-text search and archiving for your Chromium-based browser.

JavaScriptnpmOtherarchiveweb-archive
localhost
3.8k146
tarantool/tarantool

Get your data in RAM. Get compute close to data. Enjoy the performance.

LuaOthertarantooldatabase
tarantool.io
3.7k412
sysstat/sysstat

Performance monitoring tools for Linux

CGNU General Public License v2.0cmonitoring
sysstat.github.io
3.3k481
PartialVolume/shredos.x86_64

Shredos Disk Eraser 64 bit for all Intel 64 bit processors as well as processors from AMD and other vendors which make compatible 64 bit chips. ShredOS - Secure disk erasure/wipe

MakefileOtherdiskeraser
3.1k140
bvaisvil/zenith

Zenith - sort of like top or htop but with zoom-able charts, CPU, GPU, network, and disk usage

Rustcrates.ioMIT Licensecpulinux
3k82
ColinIanKing/stress-ng

This is the stress-ng upstream project git repository. stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

CGNU General Public License v2.0stress-testingkernel
github.com/ColinIanKing/stress-ng
2.7k373
cgsecurity/testdisk

TestDisk & PhotoRec

CGNU General Public License v2.0photorecdisk
cgsecurity.org
2.5k282
hoochanlon/Free-NTFS-for-Mac

Nigate: An open-source NTFS utility for Mac. It supports all Mac models (Intel and Apple Silicon), providing full read-write access, mounting, and management for NTFS drives.

TypeScriptnpmzlib Licensentfsarm
hoochanlon.github.io/Free-NTFS-for-Mac
2.3k161