Fast, minimal and interactive terminal directory analyzer
Project description
dirgo
A fast, minimal and interactive terminal directory analyzer built with Go and Bubble Tea. Visualize disk usage, explore directories, files, and identify space hogs — all from your terminal.
Features
- Instant directory listing — files appear immediately; directory sizes compute in the background
- Proportional size bars — color-coded percentage bars for quick visual scanning
- Efficient directory scanning — uses
os.ReadDir+ manual recursion to minimize syscalls; parallel stat with bounded concurrency - Smart refresh — checks directory modtime before rescanning; skips unchanged directories
- LRU cache — bounded in-memory cache (100 entries) with disk persistence across sessions (respects
XDG_CACHE_HOME) - Line counting — automatic line count for the selected text file; batch count all with
s - Hex view — built-in hex dump for binary files (
xxdon macOS,hexdumpfallback on Linux) - Large file protection — prevents accidentally opening very large blob files
- Fuzzy search — filter entries in real time with subsequence matching
- Symlink detection — symlinks shown with
→/⇢indicators - Move to trash — safely delete files/directories with
d - Cross-platform — works on macOS, Linux, and Windows (Quick Look, file open, and cache paths adapt per OS)
- CPU profiling — built-in
--profileflag for performance analysis
Install
pip / uv (any platform)
pip install dirgo
uv tool install dirgo
Go install
go install github.com/mohsinkaleem/dirgo@latest
From source
git clone https://github.com/mohsinkaleem/dirgo.git
cd dirgo
make build
Homebrew
brew tap mohsinkaleem/tap
brew install dirgo
For maintainers, release + tap publishing steps are documented in docs/release-and-homebrew.md.
Usage
# Analyze current directory
dirgo
# Analyze a specific path
dirgo ~/Documents
# Print version
dirgo --version
# Enable CPU profiling
dirgo --profile /path/to/dir
Keybindings
| Key | Action |
|---|---|
↑ / k |
Move cursor up |
↓ / j |
Move cursor down |
← / Backspace |
Go to parent directory |
→ / l / Enter |
Open selected directory / file |
Space |
Quick Look preview (macOS qlmanage, Linux xdg-open, Windows start) |
g |
Jump to top |
G |
Jump to bottom |
PgUp / Ctrl+U |
Page up |
PgDn / Ctrl+D |
Page down |
r |
Smart refresh (skips if unchanged) |
t |
Toggle top 10 view |
o |
Open in Finder / file manager |
/ |
Search / filter |
Esc |
Cancel search / close help |
h |
Toggle hidden files |
f |
Cycle filter (all → dirs only → files only) |
s |
Count lines for all files |
c |
cd to path |
x |
Hex view (binary files) |
d |
Move to trash |
? |
Help |
q / Ctrl+C |
Quit |
Architecture
main.go Entry point, --profile/--version flags, Bubble Tea program setup
model.go Application state, Update loop, message handling
scanner.go Directory scanning with os.ReadDir + manual recursion, bounded concurrency
cache.go LRU cache with bounded eviction + gob disk persistence (XDG-aware)
entry.go FileEntry data model, sorting, filtering, fuzzy match
render.go Row rendering, header/footer, help overlay
keys.go Key bindings
styles.go Lipgloss color and style definitions (pre-defined bar color styles)
utils.go Formatting, line counting (bytes.Count + sync.Pool), helpers
Scanning Pipeline
scanDirectory()callsos.ReadDirto read the directory in a single syscall, immediately stats files, and separates directories from files.- Directory sizes are computed in parallel using
dirSizeRecursive()— a manual recursive function usingos.ReadDirthat avoids the overhead offilepath.WalkDir. Bounded concurrency is enforced via a semaphore (CPU count, max 16). - File stat is parallelised for directories with 20+ files to leverage multi-core CPUs.
Caching
- In-memory: LRU cache holding up to 100 directory scan results. Accessed on navigation; updated on scan completion.
- On-disk: Not implemented as of now. Wanted to keep it simple and deterministic.
Smart Refresh
Pressing r compares the directory's current modtime against the cached value. If unchanged, the rescan is skipped entirely (~microseconds). If changed, a full rescan is triggered.
Development
# Run tests
make test
# Run benchmarks
make bench
# CPU profile a benchmark
make profile-cpu
# Memory profile
make profile-mem
# Build cross-platform release binaries
make release
Requirements
- Go 1.21+
- macOS / Linux / Windows
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dirgo-1.1.0.tar.gz.
File metadata
- Download URL: dirgo-1.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef31cdb73c81f1fc52726f001f6bdce94419ce6e0885df0ca24261862bc6089b
|
|
| MD5 |
e3f788c9c5a1e570f291af5d2b9fd017
|
|
| BLAKE2b-256 |
025bf1e91f35eeef626441c40fb91902c7d661e1d4a3b4522799ca7e9e4c972c
|
Provenance
The following attestation bundles were made for dirgo-1.1.0.tar.gz:
Publisher:
pypi.yml on mohsinkaleem/dirgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dirgo-1.1.0.tar.gz -
Subject digest:
ef31cdb73c81f1fc52726f001f6bdce94419ce6e0885df0ca24261862bc6089b - Sigstore transparency entry: 1191384527
- Sigstore integration time:
-
Permalink:
mohsinkaleem/dirgo@b1ad36237316cc8ff94fae7d9554fdf2037d96c4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mohsinkaleem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b1ad36237316cc8ff94fae7d9554fdf2037d96c4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file dirgo-1.1.0-py3-none-any.whl.
File metadata
- Download URL: dirgo-1.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efb6b01d20785b7ba7d2b5d5eec6a64f997d470b6beedf559e762b76023ba6a4
|
|
| MD5 |
43c1633120407937db79f5e111e6d13e
|
|
| BLAKE2b-256 |
ae4129d532efde5a17484dd112529936f6b83ba285ed14bd375163fa1f7ad250
|
Provenance
The following attestation bundles were made for dirgo-1.1.0-py3-none-any.whl:
Publisher:
pypi.yml on mohsinkaleem/dirgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dirgo-1.1.0-py3-none-any.whl -
Subject digest:
efb6b01d20785b7ba7d2b5d5eec6a64f997d470b6beedf559e762b76023ba6a4 - Sigstore transparency entry: 1191384532
- Sigstore integration time:
-
Permalink:
mohsinkaleem/dirgo@b1ad36237316cc8ff94fae7d9554fdf2037d96c4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mohsinkaleem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b1ad36237316cc8ff94fae7d9554fdf2037d96c4 -
Trigger Event:
workflow_dispatch
-
Statement type: