Untitled Document

alias Command

We can create temporary and permanent alias , lets see by example , how we can create these aliases -

Temporary aliases -

We often need to run some commands frequently or sometimes almost daily . Then in such a case its really tidious task to type the commands completely . Unix/ Linux provides a shorthand for it by creating aliases , using alias command .

Loging to your machine or on any Unix terminal and run below command -

   alias lt='ls -lrt'     

This will create alias lt for the command ls -lrt , so whenever we run alias lt the command ls -lrt will be executed .Similarly we can create n number of aliases for the commands that are long in names and used regularly , which are helpful to run with minimum key strokes .

This alias will be applicable only for current session and on current host it will not be accessible from other host and also it will not work if you logout from current seesion

Permanent aliases -

To create permanent alias we need to write our aliases in .profile file . The .profile file is located at your home directory . The file is hidden file so you will see it with normal ls command , to see hidden files you have to use option a with ls .Open the .profile in vi and add the aliases for your commands .Here are few examples you can try

   alias lt='ls -lrt'  
   alias psu='ps -fu "fidirdqa"'    
It may happen that the newly added alias didn't work on execution , try with new / fresh session or Login to any host and run your alias It should work .
Untitled Document