You can rename the existing command with any names you wish using alias command. Alias is a mechanism to define new commands in Linux. Once you close the terminal the alias you have defined is automatically removed. But, you can also store the alias forever by editing the bash.rc which is a startup file of linux. This is little complex to understand so I will cover the topic permanently storing the alias in the upcoming tutorials. For now, let’s focus on defining the alias command temporarily.
I am going to rename the command “ls -l” to lsl . “ls -l” lists the file with long formation which includes permissions, date etc. If you are unknown about ls command, check the usage and power of ls commands.
To create alias:
The syntax to create the alias is:
Since, we are creating aliases temporarily, you may think that alias can be removed by simply closing the terminal and opening again. Yes, that’s one way but not dynamic and not professional. So, to unalias the syntax is:
As you can see when I unaliased lsl the command “lsl” no longer works.