Terminal Tricks: Directory Bookmarks
Tags: shell, productivity, terminal, devtips
Published: 2017-10-07 17:05:48

---
title: "Terminal Tricks: Directory Bookmarks"
description: Bookmark project folders and move around the filesystem with ease
tags: shell, productivity, terminal, devtips
canonical_url: https://alysivji.github.io/terminal-tricks-bashmarks.html
cover_image: https://thepracticaldev.s3.amazonaws.com/i/5t4bl6ln8r4iripcs9c7.gif
published: true
---


_This post was originally published on [Siv Scripts](https://alysivji.github.io/)_

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 <code>cd</code> here, an <code>ls</code> there, maybe a <code>find</code> 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](https://github.com/huyng/bashmarks). Absolute game changer. I can move around the filesystem with ease.

Feel a bit like Dr. Who.<br />
<img src="https://alysivji.github.io/images/11-20/17_tardis_meme.jpg" alt="Teleport like a boss" />

In this [Quick Hit](https://alysivji.github.io/category/quick-hits.html), we will explore Bashmarks, walk through the installation process, and get a feel of the most commonly used commands.

---

## Bashmarks

> [Bashmarks is a [bash] shell script that allows you to save and jump to commonly used directories](https://github.com/huyng/bashmarks)

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](https://github.com/techwizrd/fishmarks) and [zsh](https://github.com/jocelynmallon/zshmarks).

### Installation

Download the files into a temporary directory and install using [GNU make](https://www.gnu.org/software/make/manual/make.html):

```console
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!

### Commands

```console
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 <code>s [bookmark_name]</code> command:<br />
<img src="https://alysivji.github.io/images/11-20/17_bashmarks_save.gif" alt="Create bashmark" width=562 />

List all bashmarks with <code>l</code>:<br />
<img src="https://alysivji.github.io/images/11-20/17_bashmarks_list.gif" alt="List bashmarks" width=562 />

Navigate to project directory using <code>g [bookmark_name]</code>:<br />
<img src="https://alysivji.github.io/images/11-20/17_bashmarks_jump.gif" alt="Jump to bashmark" width=562 />

---

## Conclusion

Bashmarks is a tool that increases developer productivity.

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