Everyone knows that constantly entering commands on Cisco routers and switches can become uncomfortably repetitive. To make life somewhat easier, Cisco offers the alias command, which can help dispel part of this repetition. This is a Global Configuration command. To use it, enter the alias command and identify which privilege level you want to specify the alias for.
Here are some examples:
- Use alias exec for Privileged Mode (any command you use at the router# prompt).
- Use alias configure for Global Configuration Mode (any command you use at the router(config)# prompt).
- Use alias interface for Interface Configuration Mode (any command you use at the router(config-if)# prompt).
After specifying the privilege level, enter the alias you want to create and the command you want it to stand for. You can configure an alias to do anything that you can do at the command line. Of course, there’s a catch: An alias can’t move between modes, type in passwords, or do anything interactive for you.
Some ‘alias’ Examples
Below are the aliases and the necessary command to create that alias:
- srb – Show Running-Config | BeginRouter(config)# alias exec srb show running-config |
- beginsre – Show Running-Config | ExcludeRouter(config)# alias exec sre show running-config |
- excludesri – Show Running-Config | IncludeRouter(config)# alias exec sri show running-config |
- includesrint – Show Running-Config | InterfaceRouter(config)# alias exec srint show running-config interface
From these examples, you can see that the aliases you create don’t have to be complete commands. You can specify parameters for a command after entering the alias.
For example, to use the shortcut for the show running-config interface command ‘srint’ you can specify the interface for which you want to view configuration information after that command. Here’s an example:
srint fa0/0
IOS Has Default ‘aliases’
Here are the default command aliases:
- p stands for ping.
- h stands for help.
- lo stands for logout.
- u and un stand for undebug.
- w stands for where.
You can view these aliases by using the show alias command, whether you’ve actually configured any aliases of your own.
CellStream Consultant’s Selected Favorites
Below are some of our favorite alias commands:
Alias: s
Short for: show running-configuration
Command: alias exec s sh run
Alias: c
Command: configure terminal
Command: alias exec c conf t
Alias: sir
Command: show ip route
Command: alias exec sir sh ip ro
You can use the above alias to specify parameters, such as sir bor sir o, to show all BGP routes or all OSPF routes. Or, to see a specific route, you could use sir 10.1.1.1.
Alias: i
Short for: show ip interface brief
Command: alias exec i sh ip int brie
When using frame relay, you can use aliases like the following:
Alias: pvc
Short for: show frame-relay pvc
Command: alias exec pvc show fram pvc
Alias: dwn
Short for: show frame-relay map | include down
Command: alias exec dwn sh fram map | inc down
If you go into a certain router configuration a lot (for example, BGP AS 1234), you can use the following:
Alias: b
Short for: router bgp 1234
Command: alias configure b router bgp 1234
If you often have to use the no shutdown command on an interface, you can use this alias:
Alias: ns
Short for: no shutdown
Command: alias interface ns no shutdown
We hope this explains the use of aliases, which we obviously love. And we hope we have given you some examples you can use to dave yourself some of that repetitive typing.