# 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. ## Install Save in your project root: ## Quick Use ```bash # 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: ```bash 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. - **Repo**: https://github.com/ajeetdsouza/zoxide - **Stars**: 35K+ - **Language**: Rust - **License**: MIT ## 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 match** — `z proj api` finds `~/code/myproject/api` - **Last dir** — `z -` toggles previous directory - **Shell integrations** — bash, zsh, fish, PowerShell, nushell, elvish, xonsh, cmd - **Directly callable** — `zoxide 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 - GitHub: https://github.com/ajeetdsouza/zoxide - License: MIT --- Source: https://tokrepo.com/en/workflows/d3b64571-35cb-11f1-9bc6-00163e2b0d79 Author: AI Open Source