How helpful could aliases be?


How helpful could aliases be?


Helpfulness will vary on how much we use the command line, often times we will notice that most commands are already quite small, like: cd, pwd, ls, and ., but sometimes we will find ourselves writing the same combination of commands, for example, if we are using Chrome as our default browser, most likely chrome is the command to open the browser, and chrome [filename] is how to open a file on the browser, using this knowledge I rather have a three letter command, so I would go to my bash_profile and set an alias for it:

alias crm="chrome"

once saved, we only need to source the bash profile and then we can use crm to access the Chrome browser.

another alias I could create is because I need to know my IP address often, and thus I need to use curl on the command line, but instead of all those characters, I will change it with an alias:

alias mip="curl"

As we can see, the more we use our command line, the more helpful aliases become, yet it is also just about personal preferences.


I use an alias to open the bash profile.
Ex. alias nbp="nano ~/.bash_profile

You could also create a .bash_aliases file which is the preferred method in most for cases to store your aliases. Then source it like this . .bash_aliases the first dot means “source”