DEV Community

Jessica Doering
Jessica Doering Subscriber

Posted on

Bookmarks for Your Terminal

If you use Linux and spend a decent amount of time in the terminal, zoxide is one of those little tools that's absolutely worth trying if you haven't already.

It makes jumping between directories ridiculously fast by remembering the places you visit most often.

Instead of typing:

cd ~/Projects/my_project
Enter fullscreen mode Exit fullscreen mode

you can usually just type:

z my_project
Enter fullscreen mode Exit fullscreen mode

and you're there.

The easiest way I can describe it is bookmarks for your terminal, except you don't have to create the bookmarks yourself.

What zoxide actually does

zoxide is a smarter replacement for cd.

As you move around your filesystem, it remembers which directories you visit and how often you use them.

Then instead of typing the full path, you can jump back to a directory using only part of its name.

For example, maybe I have a project here:

/home/username/Projects/my_project
Enter fullscreen mode Exit fullscreen mode

Normally I would type something like:

cd ~/Projects/my_project
Enter fullscreen mode Exit fullscreen mode

With zoxide, after I've visited it before, I can usually just type:

z my_project
Enter fullscreen mode Exit fullscreen mode

And I'm there.

That's it.

No aliases to maintain. No giant list of paths. No remembering exactly where I put the damn thing.

It gets better the more you use it

The nice thing about zoxide is that you don't really have to organize anything.

It builds its own database based on the directories you actually visit.

So if you constantly jump into:

~/Projects/my_project
~/Documents/School
~/Projects/random-experiment-number-847
Enter fullscreen mode Exit fullscreen mode

Eventually:

z my_project
Enter fullscreen mode Exit fullscreen mode
z school
Enter fullscreen mode Exit fullscreen mode

or even something like:

z random
Enter fullscreen mode Exit fullscreen mode

can take you straight there.

zoxide ranks directories based on things like how often and how recently you've visited them, so it tends to get better at guessing where you want to go over time.

Installing it

On Arch:

sudo pacman -S zoxide
Enter fullscreen mode Exit fullscreen mode

Ubuntu/Debian users:

sudo apt install zoxide -y
Enter fullscreen mode Exit fullscreen mode

OR

curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

Then you add the initialization command for your shell.

For Fish:

zoxide init fish | source
Enter fullscreen mode Exit fullscreen mode

For Bash:

eval "$(zoxide init bash)"
Enter fullscreen mode Exit fullscreen mode

For Zsh:

eval "$(zoxide init zsh)"
Enter fullscreen mode Exit fullscreen mode

Put that in your shell config so it loads automatically.

Then just use your terminal normally.

You don't have to stop using cd

One thing I like about zoxide is that it doesn't force you into some completely different way of navigating.

You can still use:

cd ..
Enter fullscreen mode Exit fullscreen mode

or:

cd ~/Downloads
Enter fullscreen mode Exit fullscreen mode

whenever that makes sense.

I tend to use normal cd for directories that are nearby and z for jumping across my filesystem.

Something like:

z my_project
Enter fullscreen mode Exit fullscreen mode

is a lot nicer than remembering whether the project is currently hiding under:

~/Projects/apps/my_project
Enter fullscreen mode Exit fullscreen mode

or:

~/Code/projects/my_project
Enter fullscreen mode Exit fullscreen mode

or whatever organizational system I was apparently convinced was brilliant three months ago.

Interactive searching is even nicer

zoxide also supports interactive selection when paired with a fuzzy finder like fzf.

You can run:

zi
Enter fullscreen mode Exit fullscreen mode

and get an interactive list of directories zoxide knows about.

Start typing part of a directory name, pick the one you want, hit Enter, and you're there.

This is especially handy when you know you worked on something with a certain name but have absolutely no clue where you put it.

Which, if you create a ridiculous number of projects, happens a lot.

Tiny tools like this are my favorite

zoxide isn't some enormous productivity system.

It doesn't require accounts.

It doesn't want me to organize my entire life.

It doesn't have a dashboard.

It just notices where I go and makes getting back there easier.

After using it for a while, typing long directory paths starts to feel strangely unnecessary.

So if you spend much time in a Linux terminal and haven't tried zoxide yet, it's worth checking out.

Your filesystem can remain an organizational disaster.

You just don't have to remember where everything is anymore.

Top comments (0)