Cisco command aliases (shortcuts)

I find that (mis)typing the same commands over and over gets boring very quickly. Creating aliases for other commands on your Cisco equipment and save time and after a while become something you wont be able to live without 😉 There are already some default ones like “p” on your kit.

For IOS devices the basic sytax is:

m00nies-iosdevice(config)# alias [mode] [alias word] [command to be aliased]

An example of a gatekeeper device making an alias command “sc” that will execute “show gatekeeper calls” showing the number of active calls.

m00nies-iosdevice(config)#alias exec sc show gatekeeper calls
m00nies-iosdevice#sc
No active calls.

Maybe you are configuring an ospf instance quite often and it would be nice to make a shotcut to that

m00nies-iosdevice(config)#alias configure ro router ospf 100
m00nies-iosdevice(config)#ro
m00nies-iosdevice(config-router)#

Some more quite handy aliases

Description: Show running config
Alias: sr
Config: alias exec sr sho runn

Description: Show running config include “X” (my most used alias)
Alias: sri
Config: alias exec sri sho runn | inc

Description: Show interfaces last inputs
Alias: sil
Config: alias exec sil sho int | inc Last in

Description: Show running config of a specified interface
Alias: srint
Config: alias exec srint sho runn int

For an ASA/Pix th syntax is only slightly different. Using the command-alias rather than alias (alias means something else to an ASA/Pix)

m00nies-ASA(config)#command-alias exec sr show run

Also useful on ASAs is checking which aliases you have previously configured.The command below shows all the aliases configured including the default ones.

m00nies-ASA# show running-config all command-alias
command-alias exec h help
command-alias exec lo logout
command-alias exec p ping
command-alias exec s show

A good place to note that tab complete wont work with your alias commands.
More info can be found here for asa or here for ios
I’ve found the alias commands very useful and hopefully you will too. If you have any of your own please share them!

m00nie 🙂

Comments

Leave a Reply