- Refactor core traversal to single-pass O(N) tree construction - Optimize CSV output using `csv` crate for robust escaping - Optimize JSON output with zero-copy serialization - Add MANUAL.md - Bump version to 0.2.0 - Remove walkdir dependency
89 lines
2.5 KiB
Markdown
89 lines
2.5 KiB
Markdown
# Sized
|
|
|
|
A fast, concurrent, and feature-rich command-line tool for visualizing disk usage, written in Rust.
|
|
|
|
## Features
|
|
|
|
- **Fast & Concurrent**: Uses `rayon` to process directories in parallel, making it extremely fast on modern multi-core systems.
|
|
- **Rich Output**: Beautifully formatted tables with colors, distinguishing files and directories.
|
|
- **Dual Units**: Displays sizes in both Binary (MiB, GiB) and Decimal (MB, GB) units for clarity.
|
|
- **Advanced Filtering**: Filter by minimum size (`-m 10MB`) to find large items quickly.
|
|
- **Sorting**: Flexible sorting by name, type, size, or block count (`--sort`).
|
|
- **Gitignore Support**: Respects `.gitignore` and `.ignore` files to keep output clean (`-i`).
|
|
- **Export Options**: Export data to CSV or JSON for further analysis (`--format csv/json`).
|
|
- **Save to File**: Automatically save reports with timestamped filenames (`--save`).
|
|
|
|
## Installation
|
|
|
|
### From Source
|
|
Ensure you have Rust and Cargo installed. Clone the repository and install:
|
|
|
|
```bash
|
|
cargo install --path .
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Basic Usage
|
|
Analyze the current directory:
|
|
```bash
|
|
sized
|
|
```
|
|
|
|
Analyze a specific path:
|
|
```bash
|
|
sized /path/to/directory
|
|
```
|
|
|
|
### Options
|
|
|
|
| Flag | Description | Example |
|
|
|------|-------------|---------|
|
|
| `-d`, `--depth` | Recursion depth (0 = current dir only) | `sized -d 1` |
|
|
| `-m`, `--min-size` | Filter by minimum size | `sized -m 100MB` |
|
|
| `-s`, `--sort` | Sort columns (size, name, type, blocks) | `sized --sort size:asc` |
|
|
| `-f`, `--path-full` | Force absolute paths in headers | `sized -f` |
|
|
| `-i`, `--ignore` | Respect .gitignore files | `sized -i` |
|
|
| `-j`, `--threads` | Set number of threads | `sized -j 4` |
|
|
| `--format` | Output format (text, csv, json) | `sized --format json` |
|
|
| `--save` | Save output to file | `sized --save` |
|
|
|
|
### Examples
|
|
|
|
**Find large directories (depth 1), respecting gitignore, and save to CSV:**
|
|
```bash
|
|
sized . -d 1 -i -m 50MB --format csv --save
|
|
```
|
|
|
|
### Generate Shell Completions
|
|
|
|
**Bash:**
|
|
Add the following to your `.bashrc` or `.bash_profile`:
|
|
```bash
|
|
# Option 1: Source directly
|
|
source <(sized --completions bash)
|
|
|
|
# Option 2: Save to file (safer startup time)
|
|
sized --completions bash > ~/.sized_completions.bash
|
|
echo "source ~/.sized_completions.bash" >> ~/.bashrc
|
|
```
|
|
|
|
**Zsh:**
|
|
```bash
|
|
# In your .zshrc
|
|
sized --completions zsh > /usr/local/share/zsh/site-functions/_sized
|
|
# OR
|
|
sized --completions zsh > ~/.zfunc/_sized
|
|
fpath+=~/.zfunc
|
|
autoload -Uz compinit && compinit
|
|
```
|
|
|
|
**Fish:**
|
|
```bash
|
|
sized --completions fish > ~/.config/fish/completions/sized.fish
|
|
```
|
|
|
|
## License
|
|
|
|
[MIT](LICENSE)
|