Zoxide is a smarter cd command that learns your habits. Written in Rust, it remembers which directories you visit most and lets you jump to them with minimal keystrokes. But its real power is the database API most people never discover.
What Makes Zoxide Special?
- Smart ranking — uses a frecency algorithm (frequency + recency)
- Works everywhere — bash, zsh, fish, PowerShell, Nushell, Xonsh
- Instant — written in Rust, sub-millisecond response times
- Database API — query and manipulate the directory database programmatically
The Hidden API: Database Queries
Zoxide maintains a SQLite-compatible database you can query directly:
# List all tracked directories with scores
zoxide query --list --score
# Find directories matching a pattern
zoxide query --list project
# Get the top-ranked match
zoxide query project api
Database Management API
# Add a directory manually
zoxide add /path/to/project
# Remove a directory
zoxide remove /path/to/old/project
# Import from other tools
zoxide import --from autojump /path/to/autojump/db
zoxide import --from z /path/to/z/data
Building Tools on Top of Zoxide
You can build powerful navigation tools using zoxide's database:
import subprocess
def get_frequent_dirs(min_score=10):
result = subprocess.run(
["zoxide", "query", "--list", "--score"],
capture_output=True, text=True
)
dirs = []
for line in result.stdout.strip().split("\n"):
score, path = line.strip().split(maxsplit=1)
if float(score) >= min_score:
dirs.append({"score": float(score), "path": path})
return sorted(dirs, key=lambda x: x["score"], reverse=True)
top_dirs = get_frequent_dirs(min_score=50)
for d in top_dirs[:10]:
print(f"{d['score']:>8.1f} {d['path']}")
Quick Start
# Install
brew install zoxide
# or
cargo install zoxide
# Add to shell
eval "$(zoxide init bash)"
eval "$(zoxide init zsh)"
Why It Matters
A senior developer told me: "I navigate 200+ project directories daily. Zoxide saved me roughly 45 minutes per day. The frecency algorithm is scarily accurate."
Need to automate data collection or build custom tools? Contact me at spinov001@gmail.com or check out my scraping solutions.
What's your terminal navigation setup? Try zoxide and let me know!
Top comments (0)