Cisco: Making Long Commands Short with Aliases

Posted October 11, 2006 by AWfki in Cisco networking

The following tech-recipe explains configuring aliases for frequently used commands.

If you are like you me, you hate typing in long commands over and over.

Instead of typing sh ip int br all the time, it would be nice simply to type sib. You can do it by configuring an alias. Here is how this is done.

In configure mode, enter the following:
alias exec sib Show ip Int Brief

Hit enter, and exit config mode. Now type sib, and you should get the output from the show ip interface brief command. Note that the odd capitalization is not needed. It is just a thing I do to help me remember what the alias is doing.

You can pipe it just like you could normally, so sib | i down will show only lines with “down” in the text. If you type sib, add a SPACE, and then hit TAB, the alias will be expanded to Show ip Int Brief.

You could alias create aliases such as the following:
alias exec sibd Show ip Int Brief | include down *down

That will show you only interfaces that have “down,” some spaces, and “down” again. If you have a router/switch with a hundred or more interfaces, this is a quick way to look for the one with the problem.

Alias exec is not the only option, it is also possible to create aliases that only work in config mode or config-interface mode. I do not use them, so you should check for more information.

Cisco configures some aliases by default. You can see them and any you have configured with the following command: show alias

The Conversation

Follow the reactions below and share your own thoughts.