4.9.09

How to set short command in IOS to save time

Using Aliases for CLI Commands

Category: Command line

To save time and the repetition of entering the same command multiple times, you can use a command alias. An alias can be configured to do anything that can be done at the command line, but an alias cannot move between modes, type in passwords, or perform any interactive functions.

Command Alias
Original Command

h

help

lo

logout

p

ping

s

show

u or un

undebug

w

where


To create a command alias, issue the alias command in global configuration mode. The syntax of the command is alias mode command-alias original-command. Following are some examples:

Router(config)# alias exec prt partition—privileged EXEC mode

Router(config)# alias configure sb source-bridge—global configuration mode

Router(config)# alias interface rl rate-limit—interface configuration mode

To view both default and user-created aliases, issue the show alias command.


For example :

In configure mode enter:
Router(config)#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 isn’t needed, it’s 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 like:

Router(config)#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’ve got a router/switch with a hundred or more interfaces this is a quick way to look for the one with the problem.

Alias exec isn’t the only option, it’s also possible to create aliases that only work in config mode or config-interface mode.

1 comment:

K.Bayat said...

salam ostad , ba tashkor, ostad baratoon emkan dareh marahel config kardan router ro b soorat sintax too web log bezareen?