Working with BASH Aliases

Adding Aliases

A BASH aliases is a customizable keyword which can be assigned to any command. This is quite handy if you commonly mistype a spesific command or, as in the below examle, you wish to simplify a command

To create a temporary alias for the current terminal session* you can simply type the alias command directly into the BASH shell. For example to create an alias python for the command python3 the command is:

alias python="python3"

In this example the alias command of python will refer to the more spesific python3

This means that the formula for adding a bash alias is:

alias alias_name="command_to_run"

To create or edit a permanent alias, or see all your aliases you can open your ~/.bashrc file. By adding the alias command as its own line in this file you can ensure that every BASH session* will have this alias availible.

* A terminal or BASH session is a single time a terminal window is open. For example two open terminal windows would be two sessions and, if a session is closed and the terminal is opened again that is a new session.
Read more about BASH on Wikipedia