z
z - jump around
Shell script that tracks the directories you visit most and lets you jump to them by typing a fragment of the path.
z is a small shell utility that makes navigating your computer's file system much faster from the command line. Instead of typing full directory paths every time you want to go somewhere, z learns which folders you visit most often and lets you jump to them by typing just a part of their name.
The key idea is "frecency" — a combination of frequency and recency. z tracks every folder you visit and assigns each one a score based on how often and how recently you've been there. When you type z foo, it automatically changes your current directory to whichever folder best matches "foo" based on that score. If you want the most recently visited match instead, you can use z -t foo; for the highest-ranked match regardless of recency, use z -r foo. You can also combine search terms: z foo bar will match a path that contains both words in that order.
After a short learning period — just using cd normally as you work — z builds up a database of your folder history. You install it by adding a single line to your shell's startup file and then just use it naturally. It works with bash and zsh.
You'd use z when you find yourself constantly navigating to the same few directories and want to save keystrokes. It's a lightweight, single-file shell script with no dependencies beyond your shell itself.
Where it fits
- Jump back to a deeply nested project folder by typing a single word.
- Replace long cd commands in daily terminal work with z foo style shortcuts.
- Inspect the frecency database to see which directories you actually use.
- Add z to a shared dotfiles repo so the team gets the same shortcut behavior.