thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

β˜… zoxide: cd within the same directory

β€’ 146 words β€’ 1 min β€’ updated

⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.

I am a big fan of zoxide:

A smarter cd command. Supports all major shells.

The idea is simple: as you keep cding during the day, it builds up a local database of your most frequently accessed directories.

Perhaps you cd often to ~/projects/company/major/area/foo.

Next time, run z foo, and it will magically cd into it.

What if you have ~/Downloads/foo as well? Then it will cd to the one you access more frequently.

It does so transparently and dynamically, out-of-the-box, without any extra intervention.

Sometimes though it cds to a directory you didn’t intend.

To instruct it to cd to a subdirectory within $PWD (the current working directory), just pass a slash (/) as its second argument:

shell
~/projects/company$ z foo /

In the previous example, it would not cd to ~/Downloads.

There are many similar projects to zoxide. In the past, I used autojump.