How to configure Aliases in CISCO IOS

Cisco IOS: Making Long Commands Short with Aliases

Reducing the length of the CISCO IOS commands by defining aliases makes you comfortable while configuring and troubleshooting the network. Besides, it saves a lot of time when preparing and taking your CCIE Exam LAB.

ALIAS command is the best way to shorten the length of frequently used CISCO IOS commands. There are some predefined aliases in CISCO IOS which can be seen by issuing the "show alias" command in enable mode.

Router#show alias Exec mode aliases: h        help lo      logout p       ping r        resume s        show u       undebug un    undebug w      where

It would be much easier for one to type only the letter "s" instead of typing the word "show". One can define the aliases according to one's requirement. Here is how to define aliases for frequently used commands.

NOTE: Aliases are configured on the Global Configuration Mode. I will post here some of the aliases which I frequently use.

ROUTER# configure terminal

ROUTER(config)# alias exec p4 show ip int brief

ROUTER(config)# alias exec p6 show ipv6 int brief

ROUTER(config)# alias exec ips show ip aliases

ROUTER(config)#

ROUTER(config)# alias exec e show run  | sec router eigrp

ROUTER(config)# alias exec o show run  | sec router ospf

ROUTER(config)# alias exec i show run | begin ^router isis

ROUTER(config)# alias exec b show run  | sec router bgp

ROUTER(config)# alias exec r show run | sec rip

ROUTER(config)#

ROUTER(config)# alias exec b4 show bgp ipv4 unicast summary

ROUTER(config)# alias exec b6 show bgp ipv6 unicast summary

ROUTER(config)# alias exec v4 show bgp vpnv4 unicast all summary

ROUTER(config)# alias exec v6 show bgp vpnv6 unicast all summary

ROUTER(config)# alias exec ba show ip bgp all summary

ROUTER(config)#

ROUTER(config)# alias exec o4 show ip ospf neighbor

ROUTER(config)# alias exec o6 show ipv6 ospf neighbor

ROUTER(config)# alias exec oi4 show ip ospf interface brief

ROUTER(config)# alias exec oi6 show ipv6 ospf interface brief

ROUTER(config)# exit

ROUTER#

Verification

ROUTER#show alias Exec mode aliases: h help lo logout p ping s show u undebug un undebug w where p4 show ip int brief p6 show ipv6 int brief ips show ip aliases e show run | sec router eigrp o show run | sec router ospf i show run | begin ^router isis b show run | sec router bgp r show run | sec rip b4 show bgp ipv4 unicast summary b6 show bgp ipv6 unicast summary v4 show bgp vpnv4 unicast all summary v6 show bgp vpnv6 unicast all summary ba show ip bgp all summary o4 show ip ospf neighbor o6 show ipv6 ospf neighbor oi4 show ip ospf interface brief oi6 show ipv6 ospf interface brief TIP: The easy way to configure aliases on all Router is to Copy it and Paste on global configuration modes of all Routers. 🙂

USAGE: When you type P4, it will give you the output of the command "show ip interface brief"

ROUTER# p4 Interface                    IP-Address             OK? Method Status                           Protocol FastEthernet0/0        unassigned           YES  unset      administratively down down ROUTER# ROUTER# p6

FastEthernet0/0            [administratively down/down] unassigned

ROUTER# ROUTER# configure terminal

ROUTER(config)# do p4

Interface                    IP-Address             OK? Method Status                           Protocol FastEthernet0/0        unassigned           YES  unset      administratively down down

ROUTER#