Problem solve Get help with specific problems with your technologies, process and projects.

IOS command shortcut favorites

Tom Lancaster recommends his favorite keyboard shortcuts for configuring Cisco routers from the command line.

While there are certainly a lot of alternatives today for configuring Cisco routers such as Ciscoworks, GUIs and SNMP, for a lot of tasks, it's hard to beat the good, old fashioned command line. Yet there's no reason to type any more than absolutely necessary. IOS comes with dozens of shortcuts, which are frankly too numerous to remember. In this tip, I've listed my favorites -- the ones used often enough to remember, and a few whose time has passed.

Given the state of terminal support for the dedicated arrow keys, quite a few of the escape sequences just aren't needed anymore. Control (Ctrl)-N and Ctrl-P move up and down the history buffer, but not as well as the "up" and "down" arrow keys. Save your brain cells for more important things! Ctrl-F and Ctrl-B move forward and backward (respectively) on a line. You might see these on a test, but it's a lot easier to remember the right and left arrow keys.

More on this topic

Router Expert: Cool IOS commands

Router Expert: More cool IOS commands - Implementing r-command support

Browse more Routing & Switching tips

The best escape sequence to remember is Ctrl-W. This deletes the last word you typed. The reason it's so useful is because (if you're like me) you probably use the tab-complete feature a lot when you're searching for some command that you know is there, but just can't quite remember. And the utility comes when you're searching a couple words deep. Type the first couple letters, then tab+complete and "?" to look at the new list of options. What you're looking for isn't there? Ctrl-W and "?" again. It'll save a lot of keystrokes.

Ctrl-L and Ctrl-R repeat the current command on a new line. This is useful when you're doing a lot of repetitive tasks, such as configuring access lists.

Ctrl-Z and Ctrl-C are probably common knowledge, but are included for completeness. Use Ctrl-Z to exit configuration mode, and Ctrl-C terminates a process, such as a continuous PING.

Ctrl-A can also be useful, particularly for things like setting temporary aliases. If you're doing something like troubleshooting, where you're typing the same command (debug... for instance) and you want to set it as an alias, just use the "up" arrow to get to the command in the history, and then use Ctrl-A to take you to the beginning of the line where you can insert your alias command (as opposed to holding down the left-arrow key to get to the beginning of the line.)

For further information, you can find a guide to using the terminal editing shortcuts on Cisco's Website.

Command shortcut quick reference

Shortcut Task
Ctrl-A alias
Ctrl-B move backward
Ctrl-C terminate process
Ctrl-F move forward
Ctrl-L repeat current command on new line
Ctrl-N move up the history buffer
Ctrl-P move down the history buffer
Ctrl-R repeat current command on new line
Ctrl-W delete last word typed
Ctrl-Z exit configuration mode

This was last published in January 2006

Dig Deeper on Network Infrastructure

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.