Skip to content

Byron/dua-cli

Repository files navigation

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 thanrm.

asciicast

Installation

Binary Release

MacOS

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

MacOS viaMacPorts:

sudo port selfupdate
sudo port install dua-cli

MacOS viaHomebrew

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 /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 viaScoop

scoop install dua

Pre-built Binaries

See thereleases sectionfor manual installation of a binary, pre-built for many platforms.

Cargo

Viacargo,which can be obtained usingrustup

ForUnix

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

ForWindows,nightly features are currently required.

cargo +nightly install dua-cli

VoidLinux

Viaxbpson your VoidLinux system.

xbps-install dua-cli

Fedora

Viadnfon your Fedora system.

sudo dnf install dua-cli

Arch Linux

Viapacmanon 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

Viapkginon 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 thereleases section. Alternatively, install via cargo as in

cargo +nightly install dua-cli

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 theiorinteractivesubcommand. 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?termionwas available previously.

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

Acknowledgements

Thanks tojwalk,all there was left to do is to write a command-line interface. Asjwalkmatures,duashould benefit instantly.

Limitations

  • Does not show symbolic links at all if no path is provided when invokingdua
    • 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 (seethis 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 intests/fixtureswhich 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 characaters it performs worse than, say iTerm3. Seehttps://github /minimaxir/big-list-of-naughty-strings/blob/master/blns.txtfor 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 au32(I guess)
    • The limitation is imposed by the underlyingpetgraphcrate, which declares it asunsafeto use u64 for instance.
    • It's possiblyUBwhen that limit is reached, however, it was never observed either.

Similar Programs