zoxide Cheatsheet
zoxide is a smarter cd command that learns your habits and lets you jump to frequently-used directories with just a few keystrokes. Fuzzy matching, interactive selection, and native shell integration. 38K+ GitHub Stars, supports every major shell.
Quick Start
``bash
z projects # Jump to best-matching directory
z my project # Multi-keyword search
zi # Interactive selection (fzf)
zoxide add /opt/myapp # Manually add a directory
eval "$(zoxide init zsh)" # Enable in your shell
`
Install & Setup
Get zoxide installed and integrated with your shell.
`bash
# Install (via package manager)
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
# Or: brew install zoxide, winget install zoxide, etc.
# Add to your shell config (bash) echo 'eval "$(zoxide init bash)"' >> ~/.bashrc
# Add to your shell config (zsh) echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc
# Add to fish echo 'zoxide init fish | source' >> ~/.config/fish/config.fish
# Migrate from original z or autojump
zoxide import ~/.z
`
Basic Usage
Jump around your filesystem with minimal keystrokes.
`bash
z projects # Fuzzy jump to ~/work/projects
z myproject # Jump to ~/src/myproject
z my project # Multi-keyword: matches ~/my_projects
z foo/bar # Sub-path matching
zoxide add . # Add current directory to database
zoxide add /opt/myapp # Add a specific directory
zoxide remove /tmp/old # Remove a directory from database
`
Interactive Mode
Use fzf-powered interactive selection when fuzzy matching returns too many options.
`bash
zi # Interactive directory picker
zi docs # Interactive, filtered to "docs" matches
zoxide query -i work # Interactive query mode
`
Query Options
Query the database directly without jumping.
`bash
zoxide query docs # Print best match for "docs" (no jump)
zoxide query -l project # List all matches for "project"
zoxide query -i work # Interactive query using fzf
zoxide query -exclude /tmp project # Exclude a directory from query
`
Configuration
Customize zoxide's behavior to fit your workflow.
`bash
# Use a different command name (e.g., 'j' instead of 'z')
eval "$(zoxide init zsh --cmd j)"
# Don't register default commands (manual setup) eval "$(zoxide init zsh --no-cmd)"
# Set custom database path export _Z_DATA=$HOME/.zoxide_db
# Use with fish zoxide init fish | source
# Use with PowerShell
iex (zoxide init powershell | Out-String)
`
Expert Tips
`bash
# Jump to the second-best match (when you want the other one)
z foo bar
# Combine with fzf for advanced filtering z foo | fzf --preview 'ls -la {1}'
# Add multiple directories at once find . -type d -maxdepth 1 | xargs -I{} zoxide add {}
# Export and backup your database cp "$(_Z_DATA:-$HOME/.local/share/zoxide/db.zo)" ~/zoxide_backup.zo
# Use in scripts without interactive mode cd "$(zoxide query -l project | head -1)" ``
Basic Usage(8)
| Command | Level | ||
|---|---|---|---|
z --helpShow zoxide help | Basic | z --help | |
z DIRJump to the best matching directory | Basic | z projects | |
z foo barMatch directory with multiple keywords | Basic | z my project | |
ziInteractively select a directory (fzf-based) | Basic | zi | |
z foo/barMatch using sub-path | Basic | z work/project | |
zoxide add PATHManually add a directory to the database | Basic | zoxide add /home/user/projects/myapp | |
zoxide remove PATHRemove a directory from the database | Basic | zoxide remove /tmp/old-project | |
zoxide add .Add current directory to database | Basic | zoxide add . |
Query Options(4)
| Command | Level | ||
|---|---|---|---|
zoxide query KEYWORDQuery matching directories (no jump) | Basic | zoxide query docs | |
zoxide query -l KEYWORDList all matching directories (sorted by score) | Intermediate | zoxide query -l project | |
zoxide query -exclude PATHExclude a directory from query results | Expert | zoxide query -exclude /tmp project | |
zoxide query -i KEYWORDInteractive query (select with fzf) | Intermediate | zoxide query -i work |
Install & Setup(3)
| Command | Level | ||
|---|---|---|---|
zoxide init SHELLInitialize zoxide integration for a shell | Basic | zoxide init zsh | |
eval "$(zoxide init SHELL)"Enable zoxide in .bashrc/.zshrc | Basic | eval "$(zoxide init zsh)" | |
zoxide import PATHImport history from z (autojump, z.lua) | Intermediate | zoxide import /path/to/z/data |
Configuration(3)
| Command | Level | ||
|---|---|---|---|
zoxide init SHELL --cmd jUse a custom command name (e.g. j instead of z) | Intermediate | zoxide init zsh --cmd j | |
zoxide init SHELL --no-cmdDo not register default z/zi commands | Expert | zoxide init zsh --no-cmd | |
export _Z_DATA=PATHSpecify z-compatible database path | Intermediate | export _Z_DATA=$HOME/.zoxide_db |