Home

Awesome

diskus

CICD

A minimal, fast alternative to du -sh.

diskus is a very simple program that computes the total size of the current directory. It is a parallelized version of du -sh. On my 8-core laptop, it is about ten times faster than du with a cold disk cache and more than three times faster with a warm disk cache.

> diskus
9.59 GB (9,587,408,896 bytes)

Benchmark

The following benchmarks have been performed with hyperfine on a moderately large folder (15GB, 100k directories, 400k files). Smaller folders are not really of any interest since all programs would finish in a reasonable time that would not interrupt your workflow.

In addition to du and diskus, we also add tin-summer (sn) and dust in our comparison. Both are also written in Rust and provide much more features than diskus (check them out!). The optimal number of threads for sn (-j option) was determined via hyperfine --parameter-scan.

Cold disk cache

sudo -v
hyperfine --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' \
    'diskus' 'du -sh' 'sn p -d0 -j8' 'dust -d0'

(the sudo/sync/drop_caches commands are a way to clear the filesystem caches between benchmarking runs)

CommandMean [s]Min [s]Max [s]Relative
diskus1.746 ± 0.0171.7281.7701.00
du -sh17.776 ± 0.54917.13918.41310.18
sn p -d0 -j818.094 ± 0.56617.48218.57910.36
dust -d021.357 ± 0.32820.97421.75912.23

Warm disk cache

On a warm disk cache, the differences are smaller:

hyperfine --warmup 5 'diskus' 'du -sh' 'sn p -d0 -j8' 'dust -d0'
CommandMean [ms]Min [ms]Max [ms]Relative
diskus500.3 ± 17.3472.9530.61.00
du -sh1098.3 ± 10.01087.81122.42.20
sn p -d0 -j81122.2 ± 18.21107.31170.12.24
dust -d03532.1 ± 26.43490.03563.17.06

Installation

On Debian-based systems

You can download the latest Debian package from the release page and install it via dpkg:

wget "https://github.com/sharkdp/diskus/releases/download/v0.7.0/diskus_0.7.0_amd64.deb"
sudo dpkg -i diskus_0.7.0_amd64.deb

On Arch-based systems

pacman -S diskus

Or download diskus-bin from the AUR.

On Void-based systems

xbps-install diskus

On macOS

You can install diskus with Homebrew:

brew install diskus

Or with MacPorts:

sudo port install diskus

On Haiku

pkgman install diskus

On NixOS

nix-env -iA nixos.diskus

Or add it to environment.systemPackages in your configuration.nix.

On other systems

Check out the release page for binary builds.

Via cargo

If you have Rust 1.50 or higher, you can install diskus from source via cargo:

cargo install diskus

Windows caveats

Windows-internal tools such as Powershell, Explorer or dir are not respecting hardlinks or junction points when determining the size of a directory. diskus does the same and counts such entries multiple times (on Unix systems, multiple hardlinks to a single file are counted just once).

License

Licensed under either of

at your option.