Cisco Support Community

Using Command Aliases as Shortcuts

When troubleshooting performance problems on our campus backbone, we often need quick access to CPU and traffic stats; the commands can be lengthy, hard to remember (especially at 3:00 a.m.), and easily open to typos.

We use a lot of command aliases to provide quick shortcuts for complex commands. Here are a few examples from our core routers (Cat6513/Sup720/12.2(18)SXF5):

  • To check ARP traffic when we suspect an ARP storm, "alias exec arpstats show mls cef adjacency entry" lets us just type "arpstats 14" to see the ARP packet counts. (Note: The "arpstats" alias will need an entry number as an argument. In this example, "14" was used.)
  • To see the top CPU processes, "alias exec proc show processes cpu sorted | exclude 0.00% 0.00% 0.00%" lets us type "proc" to see a sorted list with all the minor ones excluded.

To find the interfaces handling the most traffic, a collection of aliases gives us quick access to the "collect top" commands:

  • "alias exec top collect top counters interface"
  • "alias exec top2 collect top counters interface layer-2"
  • "alias exec top3 collect top counters interface layer-3"
  • "alias exec topa collect top counters interface all"
  • "alias exec shotop show top counters interface report"
  • "alias exec notop clear top counters interface report"

And, of course, to see all of the aliases that we've defined, we do this: "alias exec alias show alias"

I'm sure you can think of other useful aliases to simplify and speed up your troubleshooting.

-Kurt Hillig, University of Michigan, Ann Arbor, Michigan, USA

The "collect top counters interface" command does require an argument when used. Also, the CLI help still works just as well as it does for any use of the IOS CLI. So, typing "top ?" gives you a list of the valid arguments and also expands the alias for you.

To receive the latest information on Cisco online tools, certifications, support documentation, insights from Cisco experts and peers, and upcoming events, check out the Cisco Technical Services Newsletter today.