Unix Concepts   «Prev  Next»

Creating Unix Aliases

The user can create aliases in the Korn shell. An alias is a nickname for an existing command or commands. The real command(s) is substituted for the alias when the shell evaluates the command line.
1 $ alias cl='clear'
2 $ alias l='ls –laF'
3 $ alias ls='ls −aF'
4 $ \ls ..
Explanation:
  1. The alias cl is an alias for clear.
  2. The alias is l. The letter l is a nickname for the command ls –laF.
  3. The alias ls is assigned the command ls –aF.
  4. The backslash turns off the meaning of the alias for the execution of this line. The real ls command, not the alias, is executed.

Alias Commands

  1. alias: List all aliases
  2. alias rm: List a specific alias.
  3. alias rm rm -i: Define an alias.
  4. alias | grep rm: List all aliases that match a pattern.
  5. rm: Temporarily use the default command, not the alias by that name.
  6. unalias rm: Disable an alias for the rest of the session.

GNU/Linux Options
-7 Strip the eighth bit on input and output.
-b hostalias
Use bind(2) to bind the local socket to an aliased address or
the address of an interface other than the one that would be
chosen by connect(2).