To create a command alias, use the alias global configuration command. Use the no form of this command to delete all aliases in a command mode or to delete a specific alias, and to revert to the original command syntax.
alias mode alias-name alias-command-line
no alias mode [alias-name]
mode  Command mode of the original and alias commands. See Table 94 for a list of options for this argument.
alias-name  Command alias.
alias-command-line  Original command syntax.
Default aliases are in EXEC mode as follows:
Command Alias | Original Command |
h | help |
lo | logout |
p | ping |
r | resume |
s | show |
w | where |
Global configuration
Release | Modification | 10.3 | This command was introduced. |
---|
You can use simple words or abbreviations as aliases. The aliases in the "Defaults" section are predefined. They can be turned off using the no alias command.
Table 94 shows the acceptable options for the mode argument in the alias global configuration command.
Argument Options | Mode |
configuration | Global configuration |
controller | Controller configuration |
exec | EXEC |
hub | Hub configuration |
interface | Interface configuration |
ipx-router | IPX router configuration |
line | Line configuration |
map-class | Map class configuration |
map-list | Map list configuration |
route-map | Route map configuration |
router | Router configuration |
See the summary of command modes in the "Using the Command Line Interface" chapter in the Configuration Fundamentals Configuration Guide for more information about command modes.
When you use online help, command aliases are indicated by an asterisk (*), as follows:
Router#lo? *lo=logout lock login logout
When you use online help, aliases that contain spaces (for example,telnet device.cisco.com 25) are displayed as follows:
Router# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)# alias exec device-mail telnet device.cisco.com 25 Router(config)# end Router# device-mail? *device-mail="telnet device.cisco.com 25"
When you use online help, the alias is expanded and replaced with the original command, as shown in the following example with the td alias:
Router(config)# alias exec td trace device Router(config)# ^Z Router# t? *td="trace device" telnet terminal test tn3270 trace
To list only commands and omit aliases, begin your input line with a space. In the following example, the alias td is not shown, because there is a space before thet? command line.
Router# t? telnet terminal test tn3270 trace
As with commands, you can use online help to display the arguments and keywords that can follow a command alias. In the following example,the alias td is created to represent the command telet device . The /debug and /line switches can be added totelnet device to modify the command:
Router(config)#alias exec td telnet device Router(config)# ^Z Router# td ? /debug Enable telnet debugging mode /line Enable telnet line mode ... whois Whois port <cr> Router#telnet device
You must enter the complete syntax for the alias command. Partial syntax for aliases are not accepted. In the following example, the parser does not recognize the command t as indicating the alias td .
Router# t % Ambiguous command: "t"
The following example creates the alias fixmyrt for the IP route198.92.116.16:
alias exec fixmyrt clear ip route 198.92.116.16
Command | Description |
---|---|
show aliases | Displays all alias commands. |
Printed for apswan@ctr.ap.nic.in on Wed Mar 5 22:32:57 PST 2003
All material in this document copyright 2000 Cisco Systems, Inc. All rights reserved. No material may be reproduced or distributed without written permission of Cisco Systems, Inc.