zoxide — Smarter cd with Fuzzy Directory Jumping
zoxide is a fast, smarter replacement for manual cd navigation.
It learns the directories you visit and lets you jump back to them using short fuzzy keywords.
Instead of typing:
cd /var/www/html/wp-content/uploads
You can type:
z uploads
And jump instantly.
1. What zoxide Does
- Tracks directories you visit
- Ranks them by frequency and recency
- Lets you jump using fuzzy matching
- Works across shell sessions
- Integrates into bash, zsh, fish, and others
It does not replace cd by default — it enhances navigation.
2. Installation
Ubuntu/Debian
sudo apt install zoxide
Initialize in Bash
echo 'eval "$(zoxide init bash)"' >> ~/.bashrc
exec bash
Verify
zoxide --version
command -v z
After initialization, you get:
z→ jumpzi→ interactive jump (requiresfzf)
3. Core Syntax
Everyday Commands (after init)
z [KEYWORDS...]
zi [KEYWORDS...]
Low-Level Commands
zoxide query [OPTIONS] [KEYWORDS...]
zoxide add <DIR>
zoxide remove <DIR>
zoxide init <SHELL>
4. Core Behavior
z
Jumps to the best matching directory based on ranking.
z uploads
zi
Interactive fuzzy selection (requires fzf).
zi wp
5. Important Commands & Options
| Command | Purpose |
|---|---|
| -- | - |
z keyword | Jump to best match |
zi keyword | Interactive picker |
zoxide query | Print best match (no jump) |
zoxide query -l | List ranked matches |
zoxide add DIR | Manually add/boost a directory |
zoxide remove DIR | Remove directory from database |
zoxide init bash --cmd j | Rename z to j |
zoxide init bash --hook pwd | Update DB only on directory change |
6. Useful Environment Variables
Set these in your shell config if needed.
Exclude Directories
export _ZO_EXCLUDE_DIRS="**/node_modules:**/vendor"
Prevents polluting the database.
Resolve Symlinks
export _ZO_RESOLVE_SYMLINKS=1
Stores canonical real paths (useful in WordPress deployments with current symlink).
Custom Database Location
export _ZO_DATA_DIR="$HOME/.local/share/zoxide"
Adjust Aging
export _ZO_MAXAGE=10000
Controls how quickly unused entries decay.
7. WordPress VPS Use Cases
Assume WordPress root:
/var/www/html
Jump to uploads instantly
z uploads
Goes to:
/var/www/html/wp-content/uploads
Jump to themes
z themes
Jump to Nginx logs
z nginx
If you've visited /var/log/nginx, it jumps there.
Interactive plugin selection
zi plugin
Choose from multiple plugin directories.
Preview matches
zoxide query -l wp
Shows ranked directories matching wp.
Seed WordPress root
zoxide add /var/www/html
Boost its ranking.
Remove stale deployment
zoxide remove /var/www/html/releases/old-release
Keeps database clean.
Rename command to j
eval "$(zoxide init bash --cmd j)"
Use:
j uploads
Replace cd (where supported)
eval "$(zoxide init zsh --cmd cd)"
Now:
cd uploads
Has fuzzy power.
Use in script
TARGET=$(zoxide query wp)
echo "$TARGET"
Retrieve best match without jumping.
8. How Ranking Works
zoxide ranks directories based on:
- Frequency of visits
- Recency
- Path score
- Aging factor
More visits → higher priority.
9. Best Practices
- Add
zoxide initat end of.bashrcor.zshrc - Exclude heavy folders like
node_modules - Use
ziwhen unsure - Use
zwhen confident - Enable
_ZO_RESOLVE_SYMLINKS=1in deployment-based WordPress setups - Keep database clean with
zoxide remove
10. Troubleshooting
z: command not found
Initialization missing.
Add to shell config:
eval "$(zoxide init bash)"
zi does nothing
Install fzf:
sudo apt install fzf
Jump goes to wrong directory
- Too many similar matches
- Exclude noisy directories
- Use
ziinstead
Performance issues
Use:
zoxide init bash --hook pwd
Reduces update frequency.
11. Cheat Sheet
z keyword # jump
zi keyword # interactive jump
zoxide query keyword # show best match
zoxide query -l keyword # list matches
zoxide add DIR # add directory
zoxide remove DIR # remove directory
# Tuning
export _ZO_EXCLUDE_DIRS="**/node_modules:**/vendor"
export _ZO_RESOLVE_SYMLINKS=1
eval "$(zoxide init bash --hook pwd)"
12. Mini Quiz
- What does
z uploadsdo? - What is the difference between
zandzi? - How do you preview matches without changing directories?
- How do you exclude
vendorfolders globally? - Why might
_ZO_RESOLVE_SYMLINKS=1be useful in WordPress deployments?
Summary
zoxide is:
- A smart directory jumper
- Faster than manual
cd - Persistent across sessions
- Perfect for repetitive VPS navigation
- Ideal for WordPress maintenance workflows