Skip to content
zoxide: a tiny tool that will noticeably speed up your terminal work

zoxide: a tiny tool that will noticeably speed up your terminal work

zoxide replaces cd with a command that learns where you go and jumps there from a few letters. Installation on any distro, the commands worth knowing and how to switch from z or autojump.

Count how many times a day you type cd followed by a long path, or press Tab five times to get through ~/work/clients/acme/backend/src. Each one takes only a few seconds, which is exactly why nobody bothers to fix it. zoxide fixes it with almost no effort, and after a week you’ll wonder how you tolerated plain cd for so long.

It’s a small Rust program that remembers the directories you visit and lets you jump to any of them by typing a fragment of the name. If you’ve used z or autojump, the idea is familiar. zoxide is the modern take on it: fast, actively maintained and available for practically every shell.

Install it in two minutes

zoxide is packaged by most distributions:

sudo pacman -S zoxide      # Arch, Manjaro
sudo dnf install zoxide    # Fedora
cargo install zoxide --locked   # anywhere with Rust

Debian and Ubuntu do have a package, but the project itself warns that it tends to lag behind. On those systems the official install script gives you the current version:

curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh

Then add one line to your shell config, for example ~/.bashrc or ~/.zshrc:

eval "$(zoxide init bash)"    # or: zoxide init zsh

Fish users use zoxide init fish | source in config.fish. Nushell, Elvish, xonsh and others are supported too. Open a new terminal and you’re done.

The commands worth knowing

For the first few hours zoxide behaves almost like cd, because it hasn’t learned anything yet. Just keep moving around as usual. Once a directory is in its database, a fragment of the name is enough:

z backend        # jump to the best match for "backend"
z acme back      # match must contain "acme" and then "back"
z -              # previous directory
z ..             # parent directory, works like cd
zi               # pick interactively from a list (needs fzf)
Demonstration of using zoxide in the terminal

Multiple words are the trick that makes it scale. With ten projects each having a src folder, z src alone is ambiguous, but z acme src lands exactly where you want.

How it decides where to go

zoxide ranks directories by “frecency”, a combination of how often and how recently you visited them. A folder you open every day wins over one you visited a hundred times last year. Old entries gradually age out, so the database stays small and reflects what you work on now, not what you worked on two jobs ago.

The database is stored locally, on Linux in ~/.local/share/zoxide. Nothing leaves your machine, and if a match is ever wrong, zi lets you choose manually.

Switching from z or autojump

If you already have years of history in another jumper, you don’t have to start from scratch. zoxide can import databases from z, autojump, fasd, z.lua, zsh-z and atuin:

zoxide import autojump

That’s the main reason to switch even if your current tool works. Many of the older jumpers are slower or barely maintained, and zoxide keeps the same habits while working the same way across bash, zsh and fish.

Pair it with fzf

fzf is a fuzzy finder for the terminal, and zoxide uses it for interactive mode. Typing zi opens a filtered list of your directories, and a few letters narrow it down in real time. It’s the best way to find a project whose name you only half remember.

zoxide, fzf, a modern shell and something like tmux or Neovim make a setup where the terminal stops being a place where you type paths and starts feeling like it knows where your work is.

Small tweaks

A few settings from the documentation are worth knowing:

  • zoxide init bash --cmd cd replaces cd itself, so there’s no new command to remember.
  • _ZO_EXCLUDE_DIRS keeps directories out of the database, for example export _ZO_EXCLUDE_DIRS="$HOME:$HOME/private/*".
  • _ZO_ECHO=1 prints the matched path before jumping, which is handy while you’re building trust in the matching.

Small tool, daily payoff

zoxide won’t speed up your builds or change how you write code. It removes a little friction that repeats dozens of times a day, and that kind of tool tends to have a bigger effect on everyday comfort than many large ones.