• Stars
    star
    2,803
  • Rank 15,573 (Top 0.4 %)
  • Language
    Rust
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

View disk space usage and delete unwanted data, fast.

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

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

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

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

  • 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 characaters 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

More Repositories

1

gitoxide

An idiomatic, lean, fast & safe pure Rust implementation of Git
Rust
7,202
star
2

google-apis-rs

A binding and CLI generator for all Google APIs
Rust
964
star
3

prodash

report progress of concurrent applications and display it in various ways
Rust
255
star
4

open-rs

Open a path or URL with the system-defined program
Rust
234
star
5

jwalk

Filesystem walk performed in parallel with streamed and sorted results
Rust
200
star
6

trash-rs

A Rust library for moving files to the Recycle Bin
Rust
152
star
7

crates-io-cli

Interact with crates.io from the command-line
Rust
93
star
8

treediff-rs

Extract differences between arbitrary datastructures
Rust
69
star
9

github-star-counter

A tool to query direct (and indirect) stars of a GitHub user or organization
Rust
59
star
10

termbook

A runner for `mdbooks` to keep your documentation tested.
Rust
46
star
11

pulldown-cmark-to-cmark

Convert pulldown-cmark Events back to the string they were parsed from
Rust
38
star
12

cargo-smart-release

Release complex cargo-workspaces automatically with changelog generation, used by `gitoxide`
Rust
37
star
13

learning-rust-with-gitoxide

Our sessions when learning Rust with gitoxide
Rust
36
star
14

yup-hyper-mock

`hyper-mock` is a utility library to help hyper clients with their testing
Rust
29
star
15

benchmarksgame-cvs-mirror

A git mirror of the benchmarksgame cvs repository
Java
17
star
16

bsuite

Provide a plugin with tools to handle ptex files
C++
16
star
17

json-tools

A zero-copy json-lexer, filters and serializer.
Rust
15
star
18

rust-tracer

A pet raytracer to see how fast rust can go
Rust
15
star
19

crates-index-diff-rs

Learn what's changed on crates.io
Rust
14
star
20

fs-utils-rs

Utilities to help working with the filesytem
Rust
12
star
21

godi

Tool to verify data integrity with maximised performance
Go
9
star
22

bcore

powerful application framework built to integrate, not separate
Python
8
star
23

tui-crates

Various crates related to handling terminal user interfaces
Rust
7
star
24

catchit-rs

A simple and fun game made with Piston and Rust
Rust
7
star
25

anon-csv-cli

A command-line utility for anonymising CSV files
Rust
6
star
26

therror

`thiserror` + killer-feature
Rust
6
star
27

cli-template-rs

A template for command-line applications in Rust - just clone to get started
Shell
5
star
28

dotfiles

My configuration files, with auto-setup for quick account initialization
Shell
4
star
29

git-count

A simple program to count objects in git repositories - for trying the `git2` library
Rust
4
star
30

BPT

*unmaintained repository * - see BSuite
C++
3
star
31

pgit

Git Command-Line Tools in Python
Python
3
star
32

git-reconstruct

A Rust tool to reconstruct git history from tarball dumps. This is especially useful when a device vendor bases its code on an unknown commit of the git of a system on a chip vendor.
Rust
3
star
33

merchants-guide

An implementation of the merchants guide coding challenge in Rust the way I would love to see it
Rust
2
star
34

rust-hack-and-learn

A web-app for managing Katas for Rust
JavaScript
2
star
35

gitplusplus

Rewrite git using c++11 facilities
C++
2
star
36

bit

A collection of frameworks most useful to running IT infrastructure
Python
2
star
37

shallow-source

for observing shallow protocol interactions with a remote
2
star
38

gogit

If I ever wanted to learn go programming, I would implement the git-core. Probably this is never going to happen.
Go
1
star
39

kattis-autori

https://open.kattis.com/problems/autori
Shell
1
star
40

kattis-sibice

https://open.kattis.com/problems/sibice
Shell
1
star
41

javascript_the-good-parts

Repository with the book's examples, in comparison with Rust
JavaScript
1
star
42

bshotgun

Write better shotgun tools, faster
Python
1
star
43

kattis-aaah

Shell
1
star
44

reproduce-rayon-hang

minimal sample to reproduce a hang caused by jwalk running within par_iter()
Rust
1
star
45

npm-tools-rs

A Rust library to help dealing with NPM modules
Rust
1
star
46

kattis-scaling-recipes

https://open.kattis.com/problems/recipes
Rust
1
star
47

kattis-aliencodebreaker

https://open.kattis.com/problems/aliencodebreaking
Rust
1
star
48

kattis-tarifa

https://open.kattis.com/problems/tarifa
Shell
1
star
49

failure-tools

Various tools to be used in conjunction with the 'failure' crate.
Rust
1
star
50

kattis-pig-latin

https://open.kattis.com/problems/piglatin
Shell
1
star
51

and-rs

Porcelain for your Android-SDK tool suite
Rust
1
star
52

byron

1
star
53

bbuild

A cmake based multi-platform build system with bcore integration
Python
1
star
54

kattis-cli-template-rs

A template for quickly getting started on kattis samples
Shell
1
star
55

hotel-reservations

An implementation of the hotel reservations coding challenge in Rust the way I would love to see it
Rust
1
star
56

kattis-recount

https://open.kattis.com/problems/recount
Shell
1
star
57

kattis-filip

https://open.kattis.com/problems/filip
Shell
1
star
58

git-commits-by-blob

An alternative backend for https://github.com/ali1234/gitxref
Rust
1
star
59

mars-rover

An implementation of the mars rover coding challenge in Rust the way I would love to see it
Rust
1
star
60

atom-byrons-edittools

Comforts you with smart tools aiding your editing workflow in Atom
CoffeeScript
1
star
61

kattis-shattered-cake

https://open.kattis.com/problems/shatteredcake
Shell
1
star
62

kattis-quadrant

https://open.kattis.com/problems/quadrant
Shell
1
star