ConfigsApr 11, 2026·1 min read

zoxide — A Smarter cd Command That Learns Your Habits

zoxide is a smarter cd command written in Rust. It tracks directories you visit and lets you jump to any of them with just a few keystrokes. Inspired by z and autojump. Works with bash, zsh, fish, PowerShell, nushell, and more.

AI
AI Open Source · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

# Install
brew install zoxide                        # macOS
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
cargo install zoxide --locked

# Hook into shell
echo "eval \"\$(zoxide init zsh)\"" >> ~/.zshrc
echo "eval \"\$(zoxide init bash)\"" >> ~/.bashrc

Usage:

z tokrepo        # Jump to nearest dir matching tokrepo
z web            # Jump to your frequent web dir
zi               # Interactive fzf picker
z foo bar        # Match dirs containing both foo and bar
z -              # Go to previous dir
Intro

zoxide is a smarter cd command written in Rust. It learns which directories you use most frequently and lets you jump to any of them with a few keystrokes. Inspired by the classic z script and autojump, but faster and supporting every major shell.

What zoxide Does

  • Frecency ranking — frequency + recency scoring for visited dirs
  • z command — jump to any tracked dir by partial name
  • zi — interactive fuzzy picker (uses fzf)
  • Multi-keyword matchz proj api finds ~/code/myproject/api
  • Last dirz - toggles previous directory
  • Shell integrations — bash, zsh, fish, PowerShell, nushell, elvish, xonsh, cmd
  • Directly callablezoxide query foo for scripting

Architecture

Rust binary that maintains a SQLite-like flat-file database at ~/.local/share/zoxide/db.zo. Each time you cd, the shell hook calls zoxide add $PWD. The z command queries the DB and returns the best match. Interactive mode pipes candidates to fzf.

Self-Hosting

Local CLI tool.

Key Features

  • Cross-shell support
  • Frecency algorithm
  • Fast matching (Rust)
  • Fuzzy interactive mode (zi)
  • Import from z, autojump, fasd
  • Scripting friendly
  • Dead entries auto-cleaned
  • No database maintenance needed

Comparison

Tool Algorithm Shells Database
zoxide Frecency All Rust flat file
z (shell script) Frecency Bash/Zsh Text file
autojump Frequency Bash/Zsh/Fish Python
fasd Frecency Bash/Zsh Shell script

常见问题 FAQ

Q: 和 fzf 配合? A: zi 自动用 fzf。设 _ZO_FZF_OPTS 环境变量定制样式。

Q: 怎么迁移 z 数据? A: zoxide import --from z ~/.z。支持 autojump、fasd、z-lua 格式。

Q: Windows 能用? A: 能。PowerShell 和 cmd 都有 init hook。

来源与致谢 Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets