Linux aliases

 Linux aliases

  • Linux 'alias' command replaces one string from the shell with another string. It is a shell built-in command.
  • It converts a complicated command into a simpler command or in other words, it creates a shortcut by replacing it with the simpler one.


  • alias <newName>=<command>           (To create alias for commands)  
  • alias <newName>=<'command arg1 arg2....'>   (To create alias for more than one argument)  
  • alias <newName>=<'/home/sssit/path/...'>        (To create alias by a path)  


[haritaraka12078@cxln4 abc3]$ alias ll='ls -l'
[haritaraka12078@cxln4 abc3]$ ll
total 12
-rw-r--r-- 1 haritaraka12078 haritaraka12078  0 May 31 15:02 file10
-rw-r--r-- 1 haritaraka12078 haritaraka12078  0 May 31 15:03 file9
-rw-r--r-- 1 haritaraka12078 haritaraka12078 13 May 31 15:05 tee1
-rw-r--r-- 1 haritaraka12078 haritaraka12078 13 May 31 15:05 tee2
-rw-r--r-- 1 haritaraka12078 haritaraka12078 13 May 31 15:06 tee2bak




[haritaraka12078@cxln4 ~]$ alias both='cat weeks.txt site.txt'
[haritaraka12078@cxln4 ~]$ both
sunday
tuesday
wednesday
saturday
sunday
tuesday
wednesday
saturday
sunday monday tuesday wednesday thursday friday saturday




[haritaraka12078@cxln4 hari_training]$ alias path='cd /home/haritaraka12078/hari_dir/hari_training'

[haritaraka12078@cxln4 ~]$ path
[haritaraka12078@cxln4 hari_training]$



[haritaraka12078@cxln4 hari_training]$ unalias path
[haritaraka12078@cxln4 hari_training]$
[haritaraka12078@cxln4 hari_training]$ path
-bash: path: command not found