Zoxide: the better cd
A while ago, I discovered Zoxide a tool which simply claims to be a smarter cd command. And indeed, since I’ve started using it everything feels smarter. It has changed my way to navigate in the terminal. The change was subtle and affects nearly all my daily work. So, in this article I want to give you a glimpse why I think everybody needs this and how I use it.
The problem and intermediate approaches
If you spend a lot of time in the terminal, you know how repetitive typing cd commands can become.
I move between directories countless times a day.
Some directories are visited frequently, some are basically abandoned.
On top of that some of the frequently visited directories are very deeply nested.
In the past, I’ve tried many ideas to navigate efficiently between directories, but none of them felt right. One of my first attempts was using symlinks to bring frequently used directories closer to my home directory. However, this caused numerous problems and didn’t really simplify navigation. Later, I switched to a very fine-grained directory structure, which made this approach obsolete.
Then I stumbled over goto, a utility to bookmark your most important directories.
This made things easier, but required constant maintenance and was not very flexible.
What all my approaches had in common was that they were static and required unnecessary manual work.
A smarter cd
Zoxide behaves like a drop-in replacement for the cd command.
The difference is that it remembers the directories I visit and builds a small internal database with scores.
Frequently and recently used directories get a higher score.
When I type a short keyword, Zoxide automatically figures out the most likely target and takes me there.
This means I no longer need to type full paths or rely on endless shell history.
It’s like cd, but with memory and support for lazy typing.
Change directories with minimal typing
A good example is the directory for this website.
It is normally located at:~/Development/nemoinho/gitea.nehrke.info/nemoinho/nehrke.info
Though to get there I usually just type:
cd nehThis short command is already enough information for Zoxide to reach my goal, no matter where I am at the moment.
The reason is its scoring system combined with fuzzy matching and shell completion.
If neh is not a directory in the current directory, Zoxide will check its internal database.
In this check it finds all matching entries and orders them by their score.
Finally it navigates you to the directory with the highest score.
Over time, it learns which directory I most likely mean when I type something and leads me there.
This is because the rating is renewed every time the directory changes.
No explicit bookmarks, or other configuration are needed.
It simply learns from usage.
My setup
By default, Zoxide provides its own command called z.
However, I prefer to keep using cd, so I configured Zoxide to take over that name.
That way, my habits remain the same, but I still get all the benefits.
After the installation using a suitable package manager (Debian: apt, macOS: brew), Zoxide still needs to be configured in the shell.
In my case, this is done in the .bashrc file.
For other shells, there are similar configurations, which are described on the project page.
# init zoxide if present and set alias cd
which zoxide > /dev/null && eval "$(zoxide init --cmd cd bash)"This line is enough to configure Zoxide.
It hooks into my shell and turns cd into a smarter version that still behaves like the original when needed.
If I want to jump to a directory that Zoxide doesn’t know yet, the normal cd behavior still applies.
What I like about Zoxide
The beauty of Zoxide is its simplicity. It doesn’t require big adjustments or plugins and has no learning curve. After just a few days, you won’t even think about it anymore, and I bet you will never see back. You just type less and still arrive faster.
Especially if you work on many projects, have to switch directories often or have deeply nested structures, this tool might be a game changer. It makes you feel empowered again and reduces mental load. In fact, it made me think much less, without losing control! Compared to all the AI in our everyday lives today, this feels very refreshing to me.
Closing words
Zoxide is one of those tools that you don’t realize you need until you try it. It’s neither flashy nor complex, but it makes Shell’s daily work so much easier. If you still find yourself typing long paths or searching your history for that one folder, install Zoxide and give it a week. Chances are, you won’t want to go back. For me it only took a day and I was hooked.