zoxide — a smarter cd#
zoxide remembers every directory you visit and ranks them by frecency
(frequency + recency). Jump to any of them by typing a fragment of the name —
no full path, no cd ../../... Call this card with cheat zoxide.
cdis still the builtin here — it works exactly as always, and everycdsilently teaches zoxide (via achpwdhook installed incore.zsh).zis the jump command. Usecdfor a week, then start usingz.
1. JUMP#
z proj # cd to your best-matching "proj" directory
z dot conf # multiple fragments — best dir matching BOTH, in order
z proj <TAB> # tab-complete to see/choose candidates
zz # back to the previous dir (alias for z -)
zi proj # INTERACTIVE: fzf-pick when several dirs match
Match is on the path tail first, so z src lands on the src you actually
use, not every src on disk. More visits → higher rank → it wins.
2. INSPECT (dry-run, no cd)#
zq proj # print which dir `z proj` would jump to
zl # the whole ranked database, scores shown (zoxide query -l -s)
zoxide query -l # paths only, no scores
3. MANAGE THE DATABASE#
za ~/work/thing # manually add or boost a dir (za = zoxide add)
zrm ~/old/path # forget one dir (zrm = zoxide remove)
zrm <TAB> # tab-completes from the db
zedit # interactive TUI: browse, re-score, delete entries
Bulk-seed from existing dirs:
fd -t d . ~/code -d 2 | while read d; do zoxide add "$d"; done
4. IMPORT from another tool#
zoxide import --from autojump ~/.local/share/autojump/autojump.txt
zoxide import --from z ~/.z # the old `z` (rupa/z) database
5. TUNING (set in zoxide.zsh)#
| Var | Effect |
|---|---|
_ZO_RESOLVE_SYMLINKS=1 |
store the real path, not the symlink |
_ZO_EXCLUDE_DIRS=… |
colon-separated globs never to rank (trash, /tmp, .git, /Volumes) |
_ZO_DATA_DIR |
where the db lives (default below) |
_ZO_ECHO=1 |
print the dir name each jump (handy while learning) |
6. WHERE THINGS LIVE#
- Database:
~/Library/Application Support/zoxide/db.zo(macOS default). - It's binary; don't hand-edit — use
zedit/zrm/za. - Back it up by copying that file; restore by copying it back.
7. OPTIONAL — make cd ITSELF zoxide#
Currently cd = builtin, z = jump (safe, no surprises). If you'd rather have
cd <fragment> jump like z, change the init in core.zsh:
eval "$(zoxide init zsh --cmd cd)" # now `cd` jumps; `cdi` = interactive
Real paths still cd normally; only unknown args trigger a frecency jump.
Trade-off: cd typo may teleport instead of erroring. Stay with z if unsure.
cheat zoxide = this card · zl = see your ranked dirs · zi = fuzzy pick.