Ease your life by assigning shortcuts to your day-to-day terminal commands within the .bash_profile

Kaushal Shah
How To's? for Coders
2 min readMar 15, 2018
.bash_profile

If you’re here today than you are one of those who are in Terminal all the time, and you regularly type long commands, you could actually ease your life and save few seconds of it to do something that needs your attention more than this. You could do this by creating aliases (shortcuts) for these day-to-day commands in your .bash_profile, which is a file in your Home directory that sets up and customizes your Terminal session.

Before we jump into this magical thing, lets take a second to locate this so called .bash_profile on your computer. Just type this in your terminal and bam it is in front of you:

$ vim ~/.bash_profile

Let’s say you often browse to your development projects directory that requires a lot of typing, such as:

$ cd ~/Documents/Development/projects

You can create a shortcut by adding the following line to .bash_profile:

alias pro="cd ~/Documents/Development/projects"

Save the file, then either quit and relaunch Terminal, or refresh the changes by typing:

$ source ~/.bash_profile

From now on, save few seconds by typing pro and magically cd into your project directory:

$ pro

One of my favorite alias is for git and I have created few aliases to handle github work:

alias gp="git pull"

so by just typing gp in my terminal I can execute git pull command:

$ gp

I hope this serves you for what you were looking for and helps you ease your daily work. Comment below with any cool aliases you have come up with and may be I can give it a swirl!

--

--

Kaushal Shah
How To's? for Coders

“It seems as though inspiration strikes at the most unlikely times”