Working from the command line can be repetitive. Are you sick of typing the same path to a directory over and over again? Are you sometimes opening a finder to see what this path was? Z to the rescue! Now you can jump to this directory with only the name of target directory.

This post states one more tool you can use to power up your command line. Previously I posted fish shell as a first superpower. This time we see how to jump around in your directories.

Installation

Installing on a mac can be done first installing fisher (github):

curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish

And afterwards add z:

fisher add jethrokuan/z

Command

The command itself is very short:

z example

A prerequisite is that you have navigate to the target directory after you installed z. We see why in the following section.

Under the hood

The technique behind this tool is quite simple. Z stores the directories you navigate too in a file. With this z stores the frequency this directory is used. After this the matching is done on the regex after the z command.

Other options are found in the help:

z help output

You can see the directory ranking with the list function:

z list output

A lot of the other functions are there to edit this file to your liking.

Hopefully the z command will help you as much as it helped me. Happy (directory)teleporting!