Zoxide

When I am working in the Linux terminal, I'm often moving around to find files and folder when working on projects. When working on multiple projects at once, it's nice to have a faster way to quickly change directory from within your current terminal window. This is where tools like zoxide can become invaluable.

The main feature of zoxide is that it remembers which directories you use most frequently, so you can "jump" to them in just a few keystrokes. So, instead of having to type out the full path to a folder you may wish to navigate to, you simply type a partial string to get there. If you use multiple operating systems, zoxide works cross-platform too, and with all major shells, which is a great benefit.

Despite the tool itself being very useful - the "recommended" way to install zoxide on Linux/WSL as stated on the projects GitHub page, is to ๐Ÿ‘Ž curl an executable script and pipe into Bash ๐Ÿ‘Ž. This is a terribly insecure trend that I've seen a lot of developers using over the years, and I wish they would stop doing it. I get that developers want to make things as easy as possible for users, but there is a certain level of trust that is automatically assumed here. While the script itself does not appear malicious - having users become comfortable installing things this way may create bad security habits.

Ok, angry rant over! ๐Ÿ˜ˆ

Installing zoxide (Arch Linux)

1sudo pacman -S zoxide

Since I'm using Zsh, I'll make a small edit to the bottom of my ~/.zshrc config file to add zoxide:

1# Add to .zshrc
2eval "$(zoxide init zsh)"

Additionally, if you use Bash, you should add this to the bottom of your ~/.bashrc file:

1# Add to .bashrc
2eval "$(zoxide init bash)"

Usage

Once zoxide is installed, and you've integrated it into your shell - close any existing shells you have open and open a new one. You can simply use the cd command like normal to navigate to your folders, and zoxide will keep track of the folders you access regularly.

Here is a quick example:

1# Navigate to project folder
2cd Work/development/gitlab/second_life/avpack
3# Go to Home folder
4cd ~
5# Navigate to my website project
6cd Website/spacebums

Now, to quickly go back to your desired folder:

1# Get back to the avpack project
2z avpack
3# Go to ~/
4z
5# Go to the ~/Website/spacebums folder 
6z space

Tools like zoxide and similarly autojump, can make life incredibly easier and increase productivity when working in a terminal window. By using zoxide as part of my "terminal toolset" it's hard to go back to the normal way of doing things.

To see some more examples of useful terminal commands which I use daily - check out my previous article.