Back to Previous Page
spacer

Set aliases for Unix/Linux commands

Aliases are short cuts of long commands. You can set aliases in bash, csh and tcsh. Following are examples of setting alias lp6 to print file on room639b. (See Print on the Physics Department printers.)
  • bash: Add following line in your ~/.bashrc file
    alias lp6='lpr -Proom639b'
    
  • csh/tcsh: Add following line in your ~/.cshrc file
    alias lp6 'lpr -Proom639b'
    

Use command

source ~/.bashrc
or
source ~/.cshrc
to make aliases available.

Type

alias
to see the list of all your aliases.

The the command of printing file paper.ps will be

lp6 paper.ps
instead of
lpr -Proom639b paper.ps

You can remove the alias by some thing like

unalias lp6

If the alias line is in your ~/.bashrc(~/.cshrc) file, you will have the alias everytime you login.