Convert Figma logo to code with AI

bootandy logodust

A more intuitive version of du in rust

8,538
183
8,538
7

Top Related Projects

47,483

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

33,285

A simple, fast and user-friendly alternative to 'find'

63,665

:cherry_blossom: A command-line fuzzy finder

A code-searching tool similar to ack, but faster.

48,640

A cat(1) clone with wings.

23,530

A modern replacement for ‘ls’.

Quick Overview

Dust is a more intuitive version of the Unix du command, designed to quickly find and analyze disk usage. It provides a user-friendly interface for visualizing disk space consumption, making it easier to identify large files and directories that are taking up significant storage.

Pros

  • Intuitive and visually appealing output, making it easier to understand disk usage at a glance
  • Faster performance compared to traditional du command, especially on large directories
  • Cross-platform support (Linux, macOS, Windows)
  • Customizable display options and sorting capabilities

Cons

  • Requires installation, unlike the built-in du command
  • May have a steeper learning curve for users accustomed to traditional command-line tools
  • Limited functionality compared to more comprehensive disk analysis tools

Getting Started

To install Dust, you can use one of the following methods:

  1. Using Cargo (Rust's package manager):

    cargo install du-dust
    
  2. On macOS using Homebrew:

    brew install dust
    
  3. On Windows using Scoop:

    scoop install dust
    

Once installed, you can use Dust by running the dust command followed by the directory you want to analyze:

dust /path/to/directory

For more options and customizations, refer to the help menu:

dust --help

Competitor Comparisons

47,483

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

Pros of ripgrep

  • Faster performance for searching large codebases
  • More advanced regex support and search options
  • Better integration with version control systems like Git

Cons of ripgrep

  • Less intuitive for users unfamiliar with command-line tools
  • Focused solely on text search, lacking file system analysis features
  • Steeper learning curve for advanced features

Code Comparison

ripgrep:

rg -i 'pattern' --type-add 'web:*.{html,css,js}' --type web

dust:

dust -d 2 /path/to/directory

Summary

ripgrep is a powerful text search tool optimized for speed and advanced searching capabilities, making it ideal for developers working with large codebases. It excels in regex support and integration with version control systems.

dust, on the other hand, is focused on disk usage analysis and visualization. It provides an intuitive way to understand file system structure and identify large files or directories.

While both tools serve different primary purposes, they can be complementary in a developer's toolkit. ripgrep is the go-to for efficient code searching, while dust helps manage disk space and understand file system hierarchies.

33,285

A simple, fast and user-friendly alternative to 'find'

Pros of fd

  • Faster performance for file searching operations
  • More extensive command-line options and filtering capabilities
  • Cross-platform support (Windows, macOS, Linux)

Cons of fd

  • Limited to file searching, doesn't provide disk usage information
  • May require additional setup or installation on some systems
  • Less intuitive for users primarily interested in disk space analysis

Code Comparison

fd:

let regex = RegexBuilder::new(&pattern)
    .case_insensitive(case_insensitive)
    .build()
    .map_err(|_| FdError::InvalidRegex)?;

dust:

pub fn get_dir_tree(
    path: &Path,
    apparent_size: bool,
    ignore_dirs: &[String],
) -> Result<Dir, String> {
    // ...
}

The code snippets highlight the different focus areas of the two projects. fd emphasizes regex pattern matching for file searching, while dust concentrates on directory tree traversal and size calculation.

Both projects are written in Rust, showcasing the language's popularity for system utilities. fd's code demonstrates its flexibility in handling search patterns, while dust's code reveals its emphasis on directory structure analysis and size computation.

63,665

:cherry_blossom: A command-line fuzzy finder

Pros of fzf

  • More versatile: Can be used for general-purpose fuzzy finding beyond just file searching
  • Extensive integration options: Works with various shells, editors, and command-line tools
  • Highly customizable: Offers numerous configuration options and keybindings

Cons of fzf

  • Less focused on disk usage analysis: Primarily a fuzzy finder, not specialized for disk space visualization
  • May require more setup: Can be more complex to configure for specific use cases compared to dust's out-of-the-box functionality

Code Comparison

dust example:

dust /path/to/directory

fzf example:

find /path/to/directory | fzf

Key Differences

  • Purpose: dust is specifically designed for disk usage analysis, while fzf is a general-purpose fuzzy finder
  • Output: dust provides a visual representation of disk usage, whereas fzf offers interactive filtering of input
  • Use case: dust is ideal for quickly identifying large files and directories, while fzf excels at searching and selecting from lists of items

Conclusion

Both tools serve different primary purposes. dust is more suitable for users specifically looking to analyze disk usage, while fzf offers broader functionality for fuzzy finding across various contexts in the command-line environment.

A code-searching tool similar to ack, but faster.

Pros of The Silver Searcher

  • Written in C, offering faster performance for large-scale searches
  • More established project with a larger user base and ecosystem
  • Supports a wider range of file types and search options out-of-the-box

Cons of The Silver Searcher

  • Less user-friendly output format compared to Dust
  • Lacks some of the modern features and customization options found in Dust
  • May require additional configuration for optimal performance on certain systems

Code Comparison

The Silver Searcher:

void *ag_malloc(size_t size) {
    void *ptr = malloc(size);
    if (ptr == NULL) {
        die("Memory allocation failed.");
    }
    return ptr;
}

Dust:

pub fn get_dir_size(path: &Path) -> Result<u64, Error> {
    let mut total_size = 0;
    for entry in WalkDir::new(path).min_depth(1).into_iter().filter_map(|e| e.ok()) {
        total_size += entry.metadata()?.len();
    }
    Ok(total_size)
}

The Silver Searcher uses C for low-level memory management, while Dust leverages Rust's safety features and higher-level abstractions for file system operations.

48,640

A cat(1) clone with wings.

Pros of bat

  • Syntax highlighting for a wide range of file types
  • Git integration showing file modifications
  • Can display line numbers and grid

Cons of bat

  • Larger binary size and slower startup time
  • More complex to use for simple file viewing tasks

Code comparison

bat:

pub fn run() -> Result<()> {
    let config = Config::from_args()?;
    let mut output = Output::new(&config);
    let mut printer = Printer::new(&config);
    // ... (additional code)
}

dust:

fn main() {
    let args = Args::parse();
    let mut du = Du::new();
    du.run(&args);
}

Key differences

  • bat is primarily a file viewer with advanced features, while dust is a disk usage analyzer
  • bat focuses on text file display and analysis, dust on directory size visualization
  • bat has more extensive language support and Git integration, dust is more lightweight and focused on a single task

Use cases

  • Use bat for enhanced file viewing, code review, and quick syntax checks
  • Use dust for analyzing disk usage, finding large files/directories, and cleaning up storage

Community and development

Both projects are actively maintained open-source tools with strong community support. bat has a larger user base and more frequent updates, while dust maintains a more focused feature set.

23,530

A modern replacement for ‘ls’.

Pros of exa

  • More comprehensive file listing features, including Git integration and extended attributes
  • Colorful and customizable output with icons and themes
  • Actively maintained with regular updates and improvements

Cons of exa

  • Slower performance for large directories compared to dust
  • Higher memory usage, especially for complex file listings
  • Steeper learning curve due to more options and features

Code comparison

exa:

pub fn print_dir(dir: &Dir, options: &Options) -> io::Result<()> {
    let mut files = Vec::new();
    for entry in dir.files() {
        files.push(entry?);
    }
    // ... (sorting and filtering logic)
    for file in files {
        print_file(&file, options)?;
    }
    Ok(())
}

dust:

fn du(dir: &Path, opt: &Opt) -> Result<u64, Error> {
    let mut total_size = 0;
    for entry in WalkDir::new(dir).min_depth(1).max_depth(opt.depth) {
        let entry = entry?;
        if entry.file_type().is_file() {
            total_size += entry.metadata()?.len();
        }
    }
    Ok(total_size)
}

Both projects are written in Rust and focus on file system operations. exa provides more detailed file listing functionality, while dust is specifically designed for disk usage analysis. exa's code snippet shows its file printing logic, whereas dust's code demonstrates its directory traversal and size calculation approach.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Build Status

Dust

du + rust = dust. Like du but more intuitive.

Why

Because I want an easy way to see where my disk is being used.

Demo

Example

Install

Cargo Packaging status

  • cargo install du-dust

🍺 Homebrew (Mac OS)

  • brew install dust

🍺 Homebrew (Linux)

  • brew install dust

Snap Ubuntu and supported systems

  • snap install dust

Pacstall (Debian/Ubuntu)

  • pacstall -I dust-bin

Anaconda (conda-forge)

  • conda install -c conda-forge dust

deb-get (Debian/Ubuntu)

  • deb-get install du-dust

x-cmd

  • x env use dust

Windows:

  • scoop install dust
  • Windows GNU version - works
  • Windows MSVC - requires: VCRUNTIME140.dll

Download

  • Download Linux/Mac binary from Releases
  • unzip file: tar -xvf _downloaded_file.tar.gz
  • move file to executable path: sudo mv dust /usr/local/bin/

Overview

Dust is meant to give you an instant overview of which directories are using disk space without requiring sort or head. Dust will print a maximum of one 'Did not have permissions message'.

Dust will list a slightly-less-than-the-terminal-height number of the biggest subdirectories or files and will smartly recurse down the tree to find the larger ones. There is no need for a '-d' flag or a '-h' flag. The largest subdirectories will be colored.

The different colors on the bars: These represent the combined tree hierarchy & disk usage. The shades of grey are used to indicate which parent folder a subfolder belongs to. For instance, look at the above screenshot. .steam is a folder taking 44% of the space. From the .steam bar is a light grey line that goes up. All these folders are inside .steam so if you delete .steam all that stuff will be gone too.

Usage

Usage: dust
Usage: dust <dir>
Usage: dust <dir>  <another_dir> <and_more>
Usage: dust -p (full-path - Show fullpath of the subdirectories)
Usage: dust -s (apparent-size - shows the length of the file as opposed to the amount of disk space it uses)
Usage: dust -n 30  (Shows 30 directories instead of the default [default is terminal height])
Usage: dust -d 3  (Shows 3 levels of subdirectories)
Usage: dust -D (Show only directories (eg dust -D))
Usage: dust -F (Show only files - finds your largest files)
Usage: dust -r (reverse order of output)
Usage: dust -o si/b/kb/kib/mb/mib/gb/gib (si - prints sizes in powers of 1000. Others print size in that format).
Usage: dust -X ignore  (ignore all files and directories with the name 'ignore')
Usage: dust -x (Only show directories on the same filesystem)
Usage: dust -b (Do not show percentages or draw ASCII bars)
Usage: dust -B (--bars-on-right - Percent bars moved to right side of screen)
Usage: dust -i (Do not show hidden files)
Usage: dust -c (No colors [monochrome])
Usage: dust -C (Force colors)
Usage: dust -f (Count files instead of diskspace)
Usage: dust -t (Group by filetype)
Usage: dust -z 10M (min-size, Only include files larger than 10M)
Usage: dust -e regex (Only include files matching this regex (eg dust -e "\.png$" would match png files))
Usage: dust -v regex (Exclude files matching this regex (eg dust -v "\.png$" would ignore png files))
Usage: dust -L (dereference-links - Treat sym links as directories and go into them)
Usage: dust -P (Disable the progress indicator)
Usage: dust -R (For screen readers. Removes bars/symbols. Adds new column: depth level. (May want to use -p for full path too))
Usage: dust -S (Custom Stack size - Use if you see: 'fatal runtime error: stack overflow' (default allocation: low memory=1048576, high memory=1073741824)"),
Usage: dust --skip-total (No total row will be displayed)
Usage: dust -z 40000/30MB/20kib (Exclude output files/directories below size 40000 bytes / 30MB / 20KiB)
Usage: dust -j (Prints JSON representation of directories, try: dust -j  | jq)
Usage: dust --files0-from=FILE (Reads null-terminated file paths from FILE); If FILE is - then read from stdin

Config file

Dust has a config file where the above options can be set. Either: ~/.config/dust/config.toml or ~/.dust.toml

$ cat ~/.config/dust/config.toml
reverse=true

Alternatives

Note: Apparent-size is calculated slightly differently in dust to gdu. In dust each hard link is counted as using file_length space. In gdu only the first entry is counted.