<p align="center">
<img src="https://raw.githubusercontent.com/rust-lang/www.rust-lang.org/master/static/images/rust-logo-blk.svg" alt="Rust Logo" width="120">
</p>
<h1 align="center">diskr</h1>
<p align="center">
<strong>Save your disk space without the panic of deleting the wrong sh*t.</strong>
</p>
<p align="center">
<img src="https://img.shields.io/badge/rust-1.80%2B-orange?logo=rust" alt="Rust">
<img src="https://img.shields.io/badge/platform-linux-blue" alt="Platform">
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
<img src="https://img.shields.io/badge/status-active-brightgreen" alt="Status">
</p>
---
Tired of that classic f*cking problem where your hard drive is suddenly full and you have zero clue what’s eating all the space?
Yeah, me too. That’s exactly why I built **diskr**.
A fast, parallel **CLI + TUI** disk usage analyzer and safe cleaner for Linux, written in Rust.
Unlike `du`, `ncdu`, `dust` or `dua-cli`, diskr doesn’t just show you the numbers — it tells you what’s safe to remove, checks disk health, finds duplicates and dev caches, and watches for fallout after you clean.
---
## Why diskr?
Most disk tools stop at “here’s what’s big”.
**diskr** goes further:
| `diskr doctor` | A–F grade + biggest reclaimable win right now |
| Real on-disk size | Uses `st_blocks`, not just apparent size |
| Safe cleanup | Trash only — never `rm -rf` |
| Post-delete watcher | `journalctl` + `lsof` monitoring for 24 hours |
| Dev-cache & duplicate hunter | Built-in, no extra tools needed |
| SMART health | Temperature, reallocated sectors, wear level |
---
## Features
### Core
- **`diskr doctor`** — One-shot dashboard with overall grade, health risks, exposed credentials, and the single biggest reclaimable chunk (with the exact command)
- **SMART health check** — Model, temperature, power-on hours, reallocated sectors, wear level
- **Parallel filesystem scan** — `jwalk` + `rayon`, real on-disk size, symlink & mount-point aware
- **Interactive TUI** — Directory tree sorted by size (`ratatui` + `crossterm`)
### Smart Finders
- Large-file finder (configurable size threshold)
- Stale-file finder (not accessed in N days)
- Unused-app detector (cross-references `apt`/`snap` with real usage signals)
- Dev-cache detector (`node_modules`, `target`, `__pycache__`, `.venv`, `.next`, and more)
- Three-stage duplicate finder (size → quick blake3 hash → full verification)
### Safety & Cleanup
- Everything goes to **trash** — never hard-deleted
- Protected system paths are always excluded
- Dry-run mode generates an editable bash script for review
- Post-delete watcher keeps an eye on journalctl and open handles for 24h
### Extras
- Docker overlay2 / volume bloat detector + optional prune
- Sensitive-file scanner (SSH keys, `.env`, `.pem`, credentials in Downloads/Desktop)
- Hardlink-aware size accounting
- JSON output for automation
- Undo history + config file support
---
## Quick Start
```bash
# Install (when published)
cargo install diskr
# Or build from source
cargo build --release
./target/release/diskr
```
### Most useful commands
```bash
diskr # interactive TUI in current directory
diskr doctor # full health + reclaim dashboard
diskr scan # summary
diskr clean --dry-run # see what would be cleaned
diskr duplicates # find duplicate files
diskr health # SMART report
diskr apps # packages idle for 90+ days
diskr sensitive # exposed credential-like files
diskr docker --prune # docker storage bloat
```
**TUI controls**
| `j` / `k` or arrows | Move |
| `Enter` / `l` | Open directory |
| `Backspace` / `h`| Go up |
| `space` | Mark item |
| `q` | Quit |
---
## Comparison
| `du` | yes | no | no | no | no |
| `ncdu` | yes | manual only | no | no | no |
| `dust` | yes | no | no | no | no |
| `dua-cli` | yes | interactive delete | no | no | no |
| **diskr** | yes | **trash + dry-run** | **SMART** | **yes** | **yes (24h)** |
---
## Safety Model
- Every delete goes through the OS trash — **never** a hard delete
- Protected prefixes (`/`, `/usr`, `/etc`, `/boot`, `/bin`, `/sys`, `/proc`, `/dev`, `/root`, `/var/lib`, `/var/log`, …) can never appear in a clean plan
- Nothing is removed without `--yes`
- `--dry-run` available on every destructive command
- Generated cleanup script is fully reviewable before execution
---
## Project Layout
```text
diskr/
├── Cargo.toml
├── src/
│ ├── main.rs
│ ├── cli.rs
│ ├── config.rs
│ ├── history.rs
│ ├── scanner/ # parallel walk, real on-disk size, blake3 hashing
│ ├── analyzer/ # size, age, duplicates, caches, health, docker, apps
│ ├── cleaner/ # trash integration + protected-path rules
│ ├── health/ # post-delete watcher + log analysis
│ └── ui/ # ratatui TUI
└── tests/
```
---
## Building & Testing
```bash
cargo build --release
./target/release/diskr
cargo test
```
Requires **Linux**.
Optional tools (`smartctl`, `journalctl`, `apt`/`snap`, `docker`) degrade gracefully if missing — the core still works.
---
## Status
Verified with `cargo build`, `cargo test`, and manual runs of every subcommand against real temp-directory fixtures.
---
## Contributing
Contributions are welcome!
- Open an issue for bugs or feature ideas
- Send a pull request
- Improve docs or add tests
Any help is appreciated — even small PRs make a difference.
---
## Star the repo
If **diskr** saves you from another “why is my disk full?” night, please give it a **star**.
It helps more people discover the project and keeps the motivation going.
---
<p align="center">
Built because I was sick of guessing where my disk space went.<br>
Now you don’t have to guess either.
</p>