June 6, 2009

Slackware Linux Tip-of-the-day: The alias command

The alias command allows you to setup a one line command to be run under an alias in bash. A simple example is : 

 

  • alias=ls, this allows you to invoke the ls command by typing dir (this can be useful for windows users). 

 

The alias command can be invoked within the command line, within a script or as part of your .bashrc file.

 The limitation is that the alias only exists within the shell that it was invoked in, if you run it as a command in a terminal the alias will be removed when the terminal closes. the exception is when you add it to you .bashrc file, when it is loaded into this file the alias will be present in all future bash terminal sessions. 

The site http://www.linfo.org/alias.html hasmore information and some examples to help you get comfortable with the functionality.

The base files is different for each shell type, but since bash is the most used I am covering it here.

Click Here!