Overview - How do I assign alias(es) to my login shell?


  
Alias is a pseudonym or shorthand for a command or series of commands, i.e., a convenient macro for frequently used command or a series of commands.

An alias definition affects the current shell execution environment and the execution environments of the subshells of the current shell. The alias definition will not affect the parent process of the current shell nor any utility environment invoked by the shell.

For shells from the C shell category (tcsh and csh), you can define alias(es) using "alias alias_name 'command'" form in .cshrc or .tcshrc file in your root directory. You can define as many aliases as you want (as long as you can remember alias names) in .cshrc or tcshrc file.

For example, you would like to assign an alias "ll" which is equivalent to a series of commands, "/usr/bin/ls -Flsa | more " in .cshrc, (yes, open your .cshrc file in your login directory first using a text editor)

alias ll '/usr/bin/ls -Flsa |more'

Once alias definition is save in .cshrc, the alias will be in effect next time you login. If you wish to make the alias in effect right now, update your alias definition by sourcing out .cshrc

$ source .cshrc

For shells from the Bourne shell category (bash, zsh, ksh and sh), you can define alias(es) using "alias alias_name='command'" form in .bashrc/.zshrc file in your root directory. You can define as many aliases as you want (as long as you can remember alias names) in .bashrc/.zshrc file.

For example, you would like to assign an alias "ll" which is equivalent to a series of commands, "/usr/bin/ls -Flsa | more " in .bashrc, (yes, open your .bashrc file in your login directory first using a text editor)

alias ll='/usr/bin/ls -Flsa |more'

Once alias definition is save in .bashrc, the alias will be in effect next time you login. If you wish to make the alias in effect right now, update your alias definition by sourcing out .bashrc; (or .zshrc or .kshrc)

$ source .bashrc

or

$ . .bashrc

For both C and Bourne shell category, you can are removed alias(es) from the current shell execution environment by using "unalias" command.

$ unalias <alias name>

For further details, of course, RTFM on "alias."