Setting up an alias for a command
After you have used the shell for a while, you will probably find that there are some commands
that you use frequently. Rather than typing them over and over, you can set up an alias for these
commands. An alias is a personalized name that stands for all or part of a command. You
can create an alias by entering:
alias name="string"in
response to the shell's usual prompt for input. This is not a normal command; it is an instruction
to the shell itself.For example, suppose you have a hard time remembering that the mv
command actually renames files. Instead, you could set up a simple alias by entering this on your
command line:
alias renam="mv"From this point onward in your session,
whenever the shell sees the command renam, the
renam is replaced with mv. The alias facility
lets you create more usable commands.Clearly, you could use an alias to save yourself some typing too.
You could define c as an alias for cat. Then you
would enter:
c fileto get the effect of:
cat file Tip: If you issue an exec sh, alias names are not exported. For
information about how to put alias definitions in your login script pointed to by the ENV variable,
see Customizing your shell environment: The ENV variable.
DBCS recommends that you use single-byte characters when specifying an alias name, because the POSIX standard states that alias names must contain only characters in the POSIX portable character set.