A WinDirStat for the terminal: it draws you the plan of what fills your disk.

See the repository

Tap or hover a box to read it. Tap a folder to go in.

  • .png850 kB
  • .rs170 kB
  • .lock59.1 kB
  • .md7.5 kB
  • .py5.2 kB
  • .toml729 B
  • .yml363 B
  • no extension8 B
  • .json2 B
Cargo
The dirrust repository, as it sits in git
Weight
1.1 MB in 26 files
Layout
Squarified, the one in treemap.rs
Color
Each extension’s hue, by FNV-1a
Date
2026-06-01

The first thing it says about its own repository

The two screenshots weigh 77.8 %. All the Rust code, 15.5 %.

A WinDirStat for the terminal: parallel scanning that never blocks the interface, a color treemap, a sortable ranking, a breakdown by extension, duplicate detection by content and deletion with a safety net. One hundred percent local, nothing is sent anywhere.

That is what a plan like this is for: the big things show before you read a single name. The one above is not an image: this page computes it with the same layout as the program, over the files that are in git.

The treemap

The algorithm is the squarified treemap by Bruls and others: it divides the area looking for rectangles as close to a square as possible, because an elongated rectangle is impossible to compare at a glance.

The rendering takes advantage of a terminal cell being tall and narrow: painting the half-block character ▀ with one foreground color and one background color, each cell gives two vertical pixels instead of one. Vertical resolution doubles without leaving the terminal. Color is consistent per extension and there is optional cushion shading for the three-dimensional look.

In strips. The classic layout. The most elongated box measures 19.7 : 1.
Squarified. The one dirrust uses. The most elongated measures 2 : 1.

The same 9 files from src/ laid out both ways, computed when this page is built.

A terminal cell is tall and narrow. With the half block, the text color paints the top half and the background color the bottom: two pixels where there was one.

Duplicates in three phases

Hashing the whole disk to find duplicates is a waste of time. dirrust rules files out in a cascade: first it groups by size, because two files of different size are never equal and that removes most of them without reading a byte; then it compares a partial hash of the survivors; and only at the end does it compute the full hash of the remaining candidates.

The hash is xxh3 from xxhash-rust, in parallel with rayon. It is non-cryptographic on purpose: the job here is to rule out fast, not to resist an adversary.

  1. On the quay

    10 files to check.

    4848484812127301185
  2. Size

    Two files of different size are never equal. Not a single byte is read.

    4848484812127301185

    6 remain

  3. Partial hash

    For those tied on size, only the beginning is compared.

    4848484812127301185

    5 remain

  4. Full hash

    Only the remaining candidates are read in full, with xxh3 in parallel.

    4848484812127301185

    4 remain

A sample batch, not a measurement: ten made-up files to show the order of the checks. The number on each is its size in kB.

How it looks in the terminal

Main view of dirrust in the terminal: ranking table, breakdown by extension and a color treemap
Ranking, breakdown by extension and treemap, all in the terminal.
Duplicates view of dirrust: groups of files with identical content detected by hash
Groups of files identical by content, ready to delete.

Scanning that does not block

The walk runs with jwalk on a background thread and talks to the interface over a crossbeam channel. The table and the treemap are built during the scan instead of appearing at the end: on a large tree, seeing the partial result is the difference between a usable tool and a progress bar.

The size can be switched on the fly between the apparent one and what it really takes on disk (st_blocks × 512), which is the one that matters when you are looking for space.

Deleting without regret

The tool deletes files, so deletion is the most conservative part: by default it goes to the XDG trash through the trash crate, there are guards on protected paths and a double confirmation for non-empty directories. Permanent deletion exists, but you have to ask for it.

The warning is on the first screen of the README, not hidden at the end.

The manifest

4,551
lines of Rust
17
modules
3
deduplication phases
11
commits
  • Rust
  • ratatui 0.30
  • jwalk
  • rayon
  • xxhash-rust / xxh3
  • crossbeam
  • XDG Trash

Let’s talk

Curious how something here is solved, or have a similar problem?