Byron / dua-cli

View disk space usage and delete unwanted data, fast.
https://lib.rs/crates/dua-cli
MIT License
4.19k stars 113 forks source link
cleaner disk efficient fast space-use terminal-based

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

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?channel=23.11&show=dua&from=0&size=50&sort=relevance&type=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

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 accidential deletions due to a multi-stage process, which makes this mode viable for exploration.

dua i
dua interactive

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

Similar Programs