Jumping quickly between deep directories16 Oct 2014
I often need to jump between different directories with very deep paths, like this:
While it only takes a handful of seconds to switch directories, the extra mental effort often derails my train of thought. Some solutions exist, but they all have their limitations. For example,
popd don’t work well for directories you haven’t visited in a while. Aliases require you to manually add a new alias to your .bashrc every time you want to save a new directory.
I recently found a solution, inspired by this post from Jeroen Janssens, that works great and feels totally natural. All it takes is a one-time change to your .bashrc that will allow you to easily save directories and switch between them. To save a directory, just use the
To navigate to a saved directory, just use the
You can display a list of your saved directories with the
marks function, and you can remove a directory from the list with the
For any of this to work, you’ll need to add this to your .bashrc, assuming you have a Mac and use the bash shell.