Giter Club home page Giter Club logo

dua-cli's Introduction

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 (all but Windows)

MacOS

curl -LSfs https://raw.githubusercontent.com/byron/dua-cli/master/ci/install.sh | \
    sh -s -- --git byron/dua-cli --crate dua

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

Windows and others

See the releases section for manual installation.

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
cargo install dua-cli --no-default-features

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

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 two available backends? crossterm works everywhere!

Why add complexity to support termion if crossterm works everywhere? The answer is compile time and binary size, which both are larger when using crossterm. Thus on Unix we still build with termion, but there is no reason to stop supporting it once crossterm has no disadvantages.

The crosstermion crate makes handling this a bit less cumbersome.

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

dua-cli's People

Contributors

bobo1239 avatar bosr avatar byron avatar cosmichorrordev avatar federicostra avatar freaky avatar herbygillot avatar ignatenkobrain avatar jackyoustra avatar jcgruenhage avatar kidonng avatar killercup avatar lcook avatar mephistophiles avatar mexus avatar mibac138 avatar ngirard avatar oconnor663 avatar rivy avatar rye avatar tim77 avatar tsathishkumar avatar vks avatar zebp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.