up previous next contents
Next: ksh Variables Up: The Korn Shell Previous: Aliases   Contents

Example 4-1: Example aliases

Example aliases are shown below:

alias rm=rm -i
This alias makes the rm command safer, by prompting you before it deletes any files or directories.  Each time you type rm, the UNIX operating system will actually interpret the command as rm -i.

alias dir=ls -al | more
This alias creates a new command named dir.  Each time you type dir at the prompt, the UNIX operating system will actually run the command sequence ls -al | more.  This shows how you can create entirely new commands with aliases.

alias
The command alias, typed by itself, shows a list of all currently defined used aliases.

To remove an alias that you have defined, use the unalias command. For instance, suppose you no longer wanted the alias dir defined for you. Just type unalias dir, and the alias will be removed from your environment.

No spaces are allowed surrounding the equal sign (=).


up previous next contents
Next: ksh Variables Up: The Korn Shell Previous: Aliases   Contents