Navigating to specific folders from the command line is tedious. Luckily, there is a simple way to create your own custom shortcuts to specific folders. They are called aliases.

Open Terminal

First, open up the Terminal app, located at Applciations > Utilities > Terminal.

Next, you need to open .bash_profile and add your aliases. .bash_profile runs every time you open Terminal, so adding aliases to this file will let you use them any time you open Terminal.

nano .bash_profile

nano is a text editor that is built in to Terminal. There are a few others, but nano is simple and will do the trick.

Add your first alias

Add your alias by typing:

alias myproject='cd ~/path/to/myproject'

Exit with control+x, then Y, then return. Now you’ve added an alias to .bash_profile, but we can’t use it until we refresh the file. In Terminal, type

source .bash_profile

Now, when you type

myproject

and hit return, you instantly navigate to the folder. Aliases aren’t limited to folders.

Doing more with aliases

Whatever you put inside the single quotes is esentially injected into the Terminal window and executed.

So you could create

alias aliases='nano .bash_profile'

or

alias gs='git status'