Skip to main content

dirgo

CI Release License: MIT

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.

dirgo screenshot

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) for instant back-navigation within a session
  • Line counting — automatic line count for the selected text file; batch count all with s
  • Hex view — built-in hex dump for binary files (xxd on macOS, hexdump fallback 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 --profile flag 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

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 explorer)
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 Clear search filter / exit top 10 / 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

For a full walkthrough of the design — component breakdown, message flow, the scanning pipeline, and a deep dive on the concurrency model — see docs/architecture.html.

Prefer to learn by doing? docs/explore.html is an interactive tour: drive a working replica of the TUI in your browser, step through the message loop one frame at a time, and run the concurrent scanner with adjustable core counts.

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       Bounded in-memory LRU cache with eviction
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

  1. scanDirectory() calls os.ReadDir to read the directory in a single syscall, immediately stats files, and separates directories from files.
  2. Directory sizes are computed in parallel using dirSizeRecursive() — a manual recursive function using os.ReadDir that avoids the overhead of filepath.WalkDir. Bounded concurrency is enforced via a semaphore (CPU count, max 16).
  3. 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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirgo-1.2.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dirgo-1.2.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file dirgo-1.2.0.tar.gz.

File metadata

  • Download URL: dirgo-1.2.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dirgo-1.2.0.tar.gz
Algorithm Hash digest
SHA256 68f05607517a69c2eb4469cec43b034b43f84c291970e08aa44b60797c27613a
MD5 a1de2289d05f8ed1775de6ad400ce726
BLAKE2b-256 b508212c64cd8faf08bf34e12b42f1f809c4c7332fc0139ca7d72d39fb5c1dac

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirgo-1.2.0.tar.gz:

Publisher: pypi.yml on mohsinkaleem/dirgo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dirgo-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: dirgo-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dirgo-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 292c4224e282c8bf1c6cd7781091ce17eaed5b1321bb2e2734fb1bd8bce57fda
MD5 ee815aaca3b41504ef49d58f67684dcb
BLAKE2b-256 0bd3c455f22dcd84e67f64020d54c3eeb727e23b0e2dd0c24baac34894da7311

See more details on using hashes here.

Provenance

The following attestation bundles were made for dirgo-1.2.0-py3-none-any.whl:

Publisher: pypi.yml on mohsinkaleem/dirgo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page