1[![Rust](https://github.com/Byron/dua-cli/workflows/Rust/badge.svg)](https://github.com/byron/dua-cli/actions) 2[![Crates.io](https://img.shields.io/crates/v/dua-cli.svg)](https://crates.io/crates/dua-cli) 3[![Packaging status](https://repology.org/badge/tiny-repos/dua-cli.svg)](https://repology.org/project/dua-cli/badges) 4 5**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`. 6 7[![asciicast](https://asciinema.org/a/316444.svg)](https://asciinema.org/a/316444) 8 9### Installation 10 11### Binary Release (all but Windows) 12 13#### MacOS 14 15```sh 16curl -LSfs https://raw.githubusercontent.com/byron/dua-cli/master/ci/install.sh | \ 17 sh -s -- --git byron/dua-cli --crate dua 18``` 19 20#### MacOS via [MacPorts](https://www.macports.org): 21```sh 22sudo port selfupdate 23sudo port install dua-cli 24``` 25 26#### MacOS via [Homebrew](https://brew.sh) 27```sh 28brew update 29brew install dua-cli 30``` 31 32#### Linux 33 34Linux requires the target to be specified explicitly to obtain the MUSL build. 35 36```sh 37curl -LSfs https://raw.githubusercontent.com/byron/dua-cli/master/ci/install.sh | \ 38 sh -s -- --git byron/dua-cli --target x86_64-unknown-linux-musl --crate dua 39``` 40 41#### Windows and others 42 43See the [releases section][releases] for manual installation. 44 45[releases]: https://github.com/Byron/dua-cli/releases 46 47#### Cargo 48Via `cargo`, which can be obtained using [rustup][rustup] 49 50For _Unix_… 51``` 52cargo install dua-cli 53 54# And if you don't need a terminal user interface 55cargo install dua-cli --no-default-features 56``` 57 58For _Windows_, nightly features are currently required. 59``` 60cargo +nightly install dua-cli 61``` 62 63#### VoidLinux 64Via `xbps` on your VoidLinux system. 65 66``` 67xbps-install dua-cli 68``` 69 70#### Fedora 71Via `dnf` on your Fedora system. 72 73``` 74sudo dnf install dua-cli 75``` 76 77#### Arch Linux 78Via `pacman` on your ArchLinux system. 79 80``` 81sudo pacman -S dua-cli 82``` 83 84#### NetBSD 85Via `pkgin` on your NetBSD system. 86 87``` 88pkgin install dua-cli 89``` 90 91Or, building from source 92 93``` 94cd /usr/pkgsrc/sysutils/dua-cli 95make install 96``` 97 98#### Windows 99 100You will find pre-built binaries for Windows in the [releases section](https://github.com/Byron/dua-cli). 101Alternatively, install via cargo as in 102 103``` 104cargo +nightly install dua-cli 105``` 106 107### Usage 108 109```bash 110# count the space used in the current working directory 111dua 112# count the space used in all directories that are not hidden 113dua * 114# learn about additional functionality 115dua aggregate --help 116``` 117 118### Interactive Mode 119 120Launch into interactive mode with the `i` or `interactive` subcommand. Get help on keyboard 121shortcuts with `?`. 122Use this mode to explore, and/or to delete files and directories to release disk space. 123 124Please note that great care has been taken to prevent accidential deletions due to a multi-stage 125process, which makes this mode viable for exploration. 126 127```bash 128dua i 129dua interactive 130``` 131 132### Development 133 134Please note that all the following assumes a unix system. On Windows, the linux subsystem should do the job. 135 136#### Run tests 137 138```bash 139make tests 140``` 141 142#### Learn about other targets 143 144``` 145make 146``` 147 148#### But why is… 149 150#### …there two available backends? `crossterm` works everywhere! 151 152Why add complexity to support `termion` if `crossterm` works everywhere? The answer is compile time and binary size, which both are larger 153when using `crossterm`. Thus on Unix we still build with `termion`, but there is no reason to stop supporting it once `crossterm` has no 154disadvantages. 155 156The `crosstermion` crate makes handling this a bit less cumbersome. 157 158### Acknowledgements 159 160Thanks to [jwalk][jwalk], all there was left to do is to write a command-line interface. As `jwalk` matures, **dua** should benefit instantly. 161 162### Limitations 163 164* Does not show symbolic links at all if no path is provided when invoking `dua` 165 * 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 166 are not a traversal root, but will not be followed. 167* Interactive mode only looks good in dark terminals (see [this issue](https://github.com/Byron/dua-cli/issues/13)) 168* _easy fix_: file names in main window are not truncated if too large. They are cut off on the right. 169* There are plenty of examples in `tests/fixtures` which don't render correctly in interactive mode. 170 This can be due to graphemes not interpreted correctly. With Chinese characters for instance, 171 column sizes are not correctly computed, leading to certain columns not being shown. 172 In other cases, the terminal gets things wrong - I use alacritty, and with certain characaters it 173 performs worse than, say iTerm3. 174 See https://github.com/minimaxir/big-list-of-naughty-strings/blob/master/blns.txt for the source. 175* In interactive mode, you will need about 60MB of memory for 1 million entries in the graph. 176* In interactive mode, the maximum amount of files is limited to 2^32 - 1 (`u32::max_value() - 1`) entries. 177 * One node is used as to 'virtual' root 178 * 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) 179 * The limitation is imposed by the underlying [`petgraph`][petgraph] crate, which declares it as `unsafe` to use u64 for instance. 180 * It's possibly *UB* when that limit is reached, however, it was never observed either. 181 182### Similar Programs 183 184* **CLI:** 185 * `du` 186 * [`dust`](https://github.com/bootandy/dust) 187 * [`dutree`](https://github.com/nachoparker/dutree) 188 * [`pdu`](https://github.com/KSXGitHub/parallel-disk-usage) 189* **TUI:** 190 * [`ncdu`](https://dev.yorhel.nl/ncdu) 191 * [`gdu`](https://github.com/dundee/gdu) 192 * [`godu`](https://github.com/viktomas/godu) 193* **GUI:** 194 * [GNOME's Disk Usage Analyzer, a.k.a. `baobab`](https://wiki.gnome.org/action/show/Apps/DiskUsageAnalyzer) 195 * Filelight 196 197[petgraph]: https://crates.io/crates/petgraph 198[rustup]: https://rustup.rs/ 199[jwalk]: https://crates.io/crates/jwalk 200[termion]: https://crates.io/crates/termion 201[tui]: https://github.com/fdehau/tui-rs 202