# retree π²
[](https://www.rust-lang.org)
[](LICENSE)
[](https://github.com/M4dPac/retree)
[](https://github.com/M4dPac/retree/releases)
[](https://github.com/M4dPac/retree)
**retree** β a modern GNU `tree`-compatible utility for displaying directory structures.
Written in Rust. Optimized for Windows. Runs on Windows, Linux, and macOS.
[π·πΊ Π ΡΡΡΠΊΠ°Ρ Π²Π΅ΡΡΠΈΡ](https://github.com/M4dPac/retree/blob/main/README.ru.md)
---
## π― Why retree?
- β
GNU `tree` compatibility
- β‘ Parallel traversal (up to 6Γ faster on large trees)
- π¨ `LS_COLORS` and `TREE_COLORS` support
- π€ Icons (Nerd Font / Unicode / ASCII)
- π¦ Export to JSON / XML / HTML
- πͺ Full NTFS support (ADS, junctions, long paths)
- π English and Russian interface
---
## π¦ Installation
### Binary releases
Download the prebuilt binary from [GitHub Releases](https://github.com/M4dPac/retree/releases), extract it, and add to `PATH`.
### Cargo
```bash
cargo install retree
```
### Build from source
```bash
git clone https://github.com/M4dPac/retree.git
cd retree
cargo build --release
```
The binary will be at `target/release/rt`.
### π Release verification
Every release includes `SHA256SUMS.txt` with checksums, signed via [Sigstore cosign](https://docs.sigstore.dev/cosign/overview/).
**Linux / macOS:**
```bash
# Download the binary, SHA256SUMS.txt and SHA256SUMS.txt.bundle from Releases
# Verify checksum
sha256sum -c SHA256SUMS.txt
# Verify signature (requires cosign)
cosign verify-blob SHA256SUMS.txt --bundle SHA256SUMS.txt.bundle \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp "github\.com/M4dPac/retree"
```
**Windows PowerShell:**
```bash
# Verify checksum
$actual = (Get-FileHash $file -Algorithm SHA256).Hash.ToLower()
if ($actual -eq $hash) { "OK: $file" } else { "FAIL: $file" }
}
```
> **Note:** β οΈ The Windows .exe is not yet Authenticode-signed. Use SHA256 + cosign verification to confirm integrity.
---
## π Quick start
> π‘ **Note:** For maximum typing speed in the terminal, the utility uses the short command `rt` (adjacent keys on the keyboard).
```bash
# Show current directory
rt
# Show hidden files
rt -a
# Limit depth
rt -L 2
# Directories only
rt -d
# Colors and icons
rt -C --icons always
# JSON output
rt -J > tree.json
# Pretty-printed JSON
rt --json-pretty > tree.json
# Parallel mode (auto-detect threads)
rt --parallel
# Parallel mode with explicit thread count
rt --parallel --threads 4
```
---
## π Usage
```
rt [OPTIONS] [PATH...]
```
### Common options
| `-a` | Show hidden files |
| `-d` | Directories only |
| `-L N` | Limit depth |
| `-P PATTERN` | Filter by glob |
| `-I PATTERN` | Exclude by glob |
| `-h` | Human-readable sizes |
| `-D` | Show modification date |
| `-J` | JSON output |
| `--json-pretty` | Pretty-printed JSON output |
| `-C` | Always use color |
| `--icons always` | Enable icons |
| `--parallel` | Parallel traversal |
| `--threads N` | Number of worker threads |
### π Full documentation
- π [CLI Reference](https://github.com/M4dPac/retree/blob/main/docs/en/cli-reference.md)
- π¨ [Color configuration](https://github.com/M4dPac/retree/blob/main/docs/en/colors.md)
- π€ [Icons](https://github.com/M4dPac/retree/blob/main/docs/en/icons.md)
- β‘ [Performance](https://github.com/M4dPac/retree/blob/main/docs/en/performance.md)
- βοΈ [Configuration](https://github.com/M4dPac/retree/blob/main/docs/en/configuration.md)
- πͺ [Windows specifics](https://github.com/M4dPac/retree/blob/main/docs/en/windows.md)
- π οΈ [Troubleshooting](https://github.com/M4dPac/retree/blob/main/docs/en/troubleshooting.md)
---
## β‘ Performance
retree uses Rayon (work-stealing), lazy metadata loading, optimized sorting, and streaming output.
Real benchmark results (median time, Criterion, `release` mode, Windows/NTFS, end-to-end):
| 100 | ~54 ms | ~14 ms | ~54 ms |
| 10 000 | ~5.3 s | ~861 ms | ~5.7 s |
| 100 000 | ~51.5 s | ~9.4 s | ~53.5 s |
| 1 000 000 | ~576 s | ~102 s | ~622 s |
πΎ **Memory usage** (PeakWorkingSet64):
| 10 000 | 15.6 MB | 6.6 MB | **58%** |
| 100 000 | 100.2 MB | 10.4 MB | **90%** |
> Parallel mode is effective starting at ~1 000 files (up to 6Γ speedup).
> Streaming mode does not build the tree in memory β 90%+ savings on large trees.
> π‘ **Tip:** to quickly preview the first N entries of a large tree, use `--streaming --max-entries N` β traversal stops immediately after outputting N entries. In standard mode, the full tree is built first, then truncated.
More details: π [Benchmarks](https://github.com/M4dPac/retree/blob/main/docs/en/performance.md)
---
## π Comparison with GNU tree
| Colors | β
| β
|
| JSON | β
| β
|
| XML | β
| β
|
| HTML | β
| β
|
| Parallel traversal | β | β
|
| Icons | β | β
|
| NTFS ADS | β | β
|
| Junction points | β | β
|
| Long paths | β | β
|
| Streaming output | β | β
|
| Multilingual UI | β | β
|
---
## πΊοΈ Roadmap
- [ ] Stable release on crates.io
- [ ] Config file (`~/.retreerc.toml`)
- [ ] `.gitignore` / `.treeignore` support
- [ ] Directory size aggregation (`--du`)
- [ ] Interactive mode
- [ ] Homebrew / Scoop / Winget packages
---
## π€ Contributing
PRs and issues are welcome.
```bash
cargo test
cargo fmt
cargo clippy
```
Details: π [Development Guide](https://github.com/M4dPac/retree/blob/main/docs/en/development.md)
---
## π License
[MIT License](LICENSE)
---
Made with β€οΈ and π¦ Rust