Friday, 24 February 2012

Cisco IOS shortcut keys


I've always liked using the command line over the GUI and in UNIX there is nothing better than using the vi-style command line in ksh. Fortunately Cisco IOS also has some shortcut keys to make the command line more efficient (though not exactly on par with ksh and vi.)

Ctrl-R - Redraw line
This can be used to redraw the current line. Useful when console messages appear while typing a command.

<TAB> - Complete command
This will complete the remainder of the word if there is only a single possibility.

Example:

TestRTR(config)#show ip in<TAB>
TestRTR(config)#show ip in

Tab won't finish the rest of the word as there are two possibilities (inspect and interface). Complete enough of the word to make it distinct and TAB can complete it for you.

TestRTR(config)#show ip ins<TAB>
TestRTR(config)#show ip inspect

Ctrl-Z - Leave config mode
This shortcut key will take you out of config mode and back to privileged EXEC mode.

? - Context sensitive help
This will show you the available commands that you can enter based on the current line buffer.

TestRTR(config)#show ip in?
inspect interface
TestRTR(config)#show ip interface ?
Async Async interface
Auto-Template Auto-Template interface
BVI Bridge-Group Virtual Interface
CDMA-Ix CDMA Ix interface

<SNIP>
 
Ctrl-Shift-6 - Break command
This key sequence can be used to break a traceroute or ping command and if you add an 'x' to the end of the sequence, it will break a telnet or ssh session from IOS to another device.

Line control commands
There are some other key combinations that you can use to manipulate the text you type in to the console and to move around a little quicker. I use the shortcut keys above most, but the these commands are quite useful too.


Ctrl-E
Move to the end of the line
Ctrl-A
Move to the beginning of the line
Ctrl-U
Erase the current line
Esc-F
Move forward one word
Esc-B
Move the cursor back one word
Ctrl-W
Deletes the word to the left of the cursor
Esc-D
Deletes the full word to the right of the cursor
Ctrl-K
Deletes all characters to the right of the cursor
Ctrl-P
Same as using the UP key
Ctrl-N
Same as using the DOWN key
Ctrl-Y
Recall the last thing deleted
Ctrl-X
Deletes everything to the left of the cursor
Ctrl-F
Move the cursor one character forward
Ctrl-D
Deletes the character to the right of the cursor


The line control keys are probably less important to remember, but the first few shortcut keys (Ctrl-Shift-6, Ctrl-R, TAB, ?, etc.) will save you the most time when using IOS.

No comments:

Post a Comment