![]() | Command aliases As its name implies, a command alias is just an alias for a command and its options and/or arguments. Defining command aliases are helpful for command and option combinations that are frequently used or difficult to remember. The alias command is used to create a command alias: $ alias listfiles=ls Running this command will create the alias listfiles that will run the ls command when invoked. To display a complete list of your alias definitions, you would use the alias command with no arguments. To display a specific alias, you would type the alias command followed by the name of the alias: $ alias listfiles The unalias command is used for deleting alias definitions: $ unalias listfiles You can verify the removal of an alias by attempting to display the alias, or by attempting to run the alias: $ alias listfiles listfiles alias not found OR $ listfiles ksh: listfiles: not found |
|
If you want to include one or more options with a command when defining an alias, the command and option(s) need to be enclosed with single quotes. For example, if you wanted to include the -l option with the ls command you would use the following syntax: $ alias longlist='ls -l' |
| * You are viewing a page from LiveFire Labs' sample online UNIX training course. Click here if you do not see a blue and green frame around this page, or view the detailed description for this course. LiveFire Labs - Online UNIX Training |