Creating Folder Browsing Shortcuts Using Aliases in Your Bash Profile

Every morning, I type a bunch of things into Terminal to get my day set-up---open files and applications, etc. These commands can get pretty long, especially when I've got a bunch of nested folders to traverse through.

I've found that I can speed up this process by creating just a few simple commands in my bash profile.

What's a bash profile?

.bash_profile is a hidden file in your Mac's home directory that containers a bunch of configuration and preferences for your Terminal.

I've found [Nate Landau's blog post](Calvin Cordozar Broadus, Jr.) on bash profiles to be extremely useful but I'm just going to quickly go over the easiest and fastest thing for me to set-up.

Directory browsing shortcut

Oftentimes, I need to get to a particular folder that's stuck in several layers of folders...

yfan$ cd Documents/CodingThings/Work/apps/webapp 

Kind of annoying right?

I can create an alias by adding the following to my .bash_profile:

yfan$ alias webapp="cd Documents/CodingThings/Work/apps/webapp"

To test things out, refresh the changes:

yfan$ source ~/.bash_profile

And try it out!

yfan$ webapp

That should just bring me to the specified folder that I wanted. No need to type a long command!