quarta-feira, 27 de abril de 2016

How to use alias in Linux system


The alias command makes it possible to launch any command or group of commands. It allows a user to create simple names or abbreviations (even consisting of just a single character) for commands regardless of how complex the original commands are and then use them in the same way that ordinary commands are used. See examples below:

To create a alias named d to see the date command, type alias d=date:






Remember this alias will only be available on this current terminal session. To add an alias to your next terminal session permanently, you need to include it at ~./bashrc file. To do it, go to your home directory, edit this ~./bashrc file and include the alias that you want. The ~./bashrc file contanis specific information about user shells bash, it is loaded when the user log on into the system. See it:

From terminal, type vi .bashrc:















Type i to edit the file and include the alias desired, press ESC key and :wq! to save it. After then, log off and log in to use the new alias. If you want see all alias in the system, type alias.














In this case, we have created a alias named p and it will show the pwd command: