Linux aliases set up simple!

Linux aliases set up simple!

Hi guys, today I will show how easy it is to set up aliases in almost any Linux distro. Before we begin let's clarify what are aliases in the bash.

Alias is a command that enables replacing a word or set of letters with a bash command. Often it is used for simplifying the workflow in the command line, for example, we can come up with an abbreviation that is going to equal multiply commands. Without further due let's hop into the setup process.

To create an alias there are 3 easy steps:

1. Navigate to your home directory.

To navigate to your home directory using the cd command.

cd /home/your_username

2. Add your alias to the .bashrc file.

After you have navigated to your home directory, open the .bashrc file with nano.

sudo nano .bashrc

Now go to the bottom of the file and type alias, then the name of the custom command and the Linux commmand/s it represents. Take in mind that there are no spaces between the equal sign, otherwise it is not going to work.

.bashrc file

You can add as many custom commands as you want. Every command should be on a new line. After you are done, save the file and exit.

3. Activate the custom commands you've added.

Probably you have noticed after saving the file when you try to run a custom command it doesn't work that is because we have not activated them yet. To activate just type in the command line source and .bashrc.

source .bashrc

And you are ready! Now you can run any of the custom commands you have created If you have any questions, comment them down I will answer them as soon as possible.