zoxide — cd that learns where you actually go

You type cd ../../.. and pray. zoxide watches where you cd and gives you z — a one-command jump to any directory you’ve ever visited, guessed from three letters.

The average shell session is 30% typing paths you’ve already typed. Zoxide keeps a small database of every directory you visit, scored by how often and how recently you’ve been there, and exposes one command: z. Type z conf and you’re in the config directory you visited this morning, not a fuzzy guess from 2019 — the ranking is frecency, and it’s startlingly good at matching intent. It hooks into bash, zsh, fish, and more with a one-line eval, tracks nothing beyond your machine unless you want it to, and since it only learns from visits, there’s zero config to maintain. The interactive fzf-powered picker (zi) covers the ambiguous cases. It’s the rare upgrade that asks nothing of you after install.

install

macOS
# macOS
brew install zoxide
Debian/Ubuntu
# Debian 11+/Ubuntu 22.04+: sudo apt install zoxide (Debian 12 and Ubuntu 22.04 ship the old 0.4.3; for current features use the install script)
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
Fedora
# Fedora
sudo dnf install zoxide
Arch
# Arch
sudo pacman -S zoxide

# Then hook it into your shell (one line, adjust for your shell)
echo 'eval "$(zoxide init bash)"' >> ~/.bashrc   # or zsh / fish

examples

# Jump to the best-scoring dir matching "config"
z config
# Multiple words = multiple filters, all must match
z work site
# Open interactively with fzf when the guess is ambiguous
zi config
# Interactive picker over every directory in the database
zi
# Peek at what zoxide would choose, without moving
zoxide query -l config
# Show everything it has learned, ranked
zoxide query -ls
# Forget a directory you never want to land in again
zoxide remove /path/to/dir

pro tip

Initialize with zoxide init --cmd cd bash and z replaces cd outright: eval "$(zoxide init --cmd cd bash)". This also makes zi into cdi. With --cmd cd, your cd habit now does frecency jumps, and cd - still takes you back to the previous directory; pushd/popd are unaffected.

honest limits

Zoxide only knows directories you’ve visited since installing it — day one feels unimpressive, day three feels like cheating. Its guess is a ranking, not an oracle: two dirs with similar names can win when you didn’t expect it, so zi is your escape hatch. And it doesn’t track environment or arguments: it can’t tell your prod checkout from your staging clone if they live at different paths — it’ll happily take you to whichever you visit more.