A number of shortcuts exist within the IOS command line interface. We’ve already seen that we could simply enter y or n to represent answering yes or no from within the System Configuration Dialog setup modes.
Before getting into the various shorthand versions of commands that can be used in the IOS, let’s look at the editing commands available. Editing commands (sometimes referred to as “hot keys”) allow you to quickly navigate the command line. For example, these can be used to move the cursor forward or back a word, move the cursor to the beginning or end of a line, and so forth. There are a number of these editing commands available, and to remember them, I suggest creating associations between the shortcuts and what they do. For example, pressing CTRL+A will move your cursor to the beginning of a line. Associate the command with the fact that the letter A begins the alphabet, and it’s easier to remember. In the same way, CTRL+E will bring you to the end of a line – just associate E with “end”. The list below outlines the primary editing commands available on a Cisco router. You’ll need to be familiar with what each key or combination does, so be sure to practice using these! Of course, they’ll also come in very handy when trying to configure a router quickly in real life.
Delete: Removes the character to the right of the cursor
Backspace: Removes the character to the left of the cursor
Up Arrow: Allows you to scroll forward through previous commands
Down Arrow: Allows you to scroll backwards through previous commands
Ctrl+P (or up arrow): Displays the last command entered
Ctrl+N (or down arrow): Displays previous commands entered
Ctrl+A: Moves the cursor to the beginning of the current line
Ctrl+E: Moves the cursor to the end of the current line
Ctrl+F: Moves forward one character
Ctrl+B: Moves backwards one character
Esc+F: Moves forward one word
Esc+B: Moves backwards one word
Ctrl+R: Redisplays a line (starts a new line, with the same command shown)
Ctrl+U: Erases a line
Ctrl+W: Erases a word
Tab: Completes a partial command
Ctrl+Z: Exits configuration mode, returning you to privileged EXEC mode
One very helpful shortcut listed in Table 1 is the Tab key – instead of having to type out a complete command, you can instead type just enough of it such that the command is not ambiguous. For example, if you were to type sh and press the Tab key, you would be presented with the completed command show. However, typing s alone and pressing tab won’t do the same. Many commands start with the letter s, and the router wouldn’t be able to determine which command you were referring to. A good way to get used to entering partial commands is to hit the tab key after entering the first few letters at the command line – this will give you a feel for how much of the command needs to be entered in order for it not to be considered ambiguous.
Similarly, commands can be issued in shorthand. For example, if you grow tired of entering the complete command enable to enter privileged mode, you could simply type en and press enter, as shown below.
However, notice what happens when you only type e and press enter in the same scenario:
% Ambiguous command: "e"
My suggestion is that you first familiarize yourself with the complete commands we look at. Next, focus on using the Tab key to complete them. Finally, figure out the shorthand versions that can be used to represent them.