Cover image for Terminal Tricks: Directory Bookmarks

Terminal Tricks: Directory Bookmarks

alysivji profile image Aly Sivji Originally published at alysivji.github.io ・2 min read

This post was originally published on Siv Scripts

Even though my development folders are well organized, I still have to feel my way around the filesystem when I'm looking for a project directory. It's like trying to find a lightswitch in a dark room: a cd here, an ls there, maybe a find when I'm stuck.

I always get to where I want to go, but not without some frustration along the way. Plus, all the seconds spent navigating directories starts to add up.

Wait a minute. I use bookmarks in my browser, so why am I not using them in my shell?

A quick Google search led me to Bashmarks. Absolute game changer. I can move around the filesystem with ease.

Feel a bit like Dr. Who.

Teleport like a boss

In this Quick Hit, we will explore Bashmarks, walk through the installation process, and get a feel of the most commonly used commands.


Bashmarks is a [bash] shell script that allows you to save and jump to commonly used directories

It supports tab completion (!!!) and has a very simple interface with only 5 commands to memorize.

Use another shell? Not a problem. There are ports of bashmarks for fish and zsh.


Download the files into a temporary directory and install using GNU make:

mkdir temp && cd temp
git clone git://github.com/huyng/bashmarks.git
cd bashmarks
make install
echo "source ~/.local/bin/bashmarks.sh" >> ~/.bash_profile
source ~/.bash_profile

And we're good to go!


s <bookmark_name> - Saves the current directory as "bookmark_name"
g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
p <bookmark_name> - Prints the directory associated with "bookmark_name"
d <bookmark_name> - Deletes the bookmark
l                 - Lists all available bookmarks

We can save bookmarks using the s [bookmark_name] command:

Create bashmark

List all bashmarks with l:

List bashmarks

Navigate to project directory using g [bookmark_name]:

Jump to bashmark


Bashmarks is a tool that increases developer productivity.

Do you have an interesting terminal workflow or trick to share? Please comment below!

Posted on Oct 7 '17 by:

alysivji profile

Aly Sivji


Chicago Python Organizer. I love building communities and mentoring junior developers.


markdown guide

I recommend to use "fasd" instead. It removes the whole need to manually enter bookmarks and automatically remembers every folder your interacted. So you just need to "cd temp" once and since then, just type "z temp" to go there.

I wrote about it here: hackernoon.com/macbook-my-command-...


Interesting - I always accomplished this by just adding a bunch of aliases to my bash profile (cdw for example just cd's into my workspace. This seems like a cleaner way to handle things when you've got a bunch of places to go!


I would also like to recommend a tool called wd. It basically does the same thing but for me the way it operates it's a little bit explicit. For example the adding of new path is wd add and it adds the current working directory.



z is also good. It keeps a list of your statistically frequent and recent cd commands. If you have a lot of directories with similar names, however, you'll probably have better luck with this approach.

The one thing I take issue with in this approach is the use of four single-letter shortcuts. For me, g is for git, and l is for ls -la.

It's weird for me to take issue with this approach this way, since I do use the z macro.


I know this is old but for anyone stumbling across this and they are using zsh then what you really want is to use hash to modify the command hash table so that you can then get an even shorter syntax and not need the extra aliases. E.g. if you run this:

hash -d o=~/Downloads/

you can then do:

$ cd ~o

or even:

$ ~o

or even even:

$ o

to change directory. You can also then substitute in ~o anywhere where you would usually place a path such as ls ~0.