C.W.K.
Stream
Lesson 03 of 08 · published

zoxide: Smart cd

~8 min · zoxide, cd, frecency

Level 0Window Tourist
0 XP0/95 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

cd, but it remembers

zoxide learns which directories you visit and ranks them by frecency (frequency × recency). After a day or two, z proj jumps straight to ~/projects/cwkPippa without typing the path.

Install and hook

brew install zoxide
echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc

By default it adds the z command. zi opens an interactive picker (uses fzf if installed).

Daily use

z pippa            # jump to highest-ranked dir matching 'pippa'
z pippa front       # match multiple substrings
z -                 # previous directory (like cd -)
zi pip              # interactive picker

Database

Stored at ~/.local/share/zoxide/db.zo. Survives reboots. zoxide query --list --score shows your ranked dirs. zoxide remove path drops a dir from the database.

How it pairs with autocd

If you have setopt AUTO_CD in zsh, you can also drop the cd: typing ../sibling jumps. Combined with zoxide's substring jumps, you barely type cd at all anymore.

Code

Bootstrap zoxide·bash
brew install zoxide
echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc
exec zsh
# Visit a few directories, then
z proj

External links

Exercise

Install zoxide and add the eval line. Visit a handful of project dirs over an afternoon. Then z to a partial name. Run zoxide query --list --score and watch the rankings.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.