CLI Help Features

If you printed the IOS Command Reference documents, you would end up with a stack of paper several feet tall. No one should expect to memorize all the commands—and no one does in real life, either. Several very easy, convenient tools can be used to help you remember commands and then also save you time typing. As you progress through your Cisco certifications, the exams will cover progressively more commands. However, you should know the methods of getting command help.

Table 7-3 summarizes command-recall help options available at the CLI. Note that, in the first column, "Command" represents any command. Likewise, "parm" represents a command's parameter. For instance, the third row lists command ?, which means that commands such as show ? and copy ? would list help for the show and copy commands, respectively.

Table 7-3 Cisco IOS Software Command Help

What You Type

The Help You Get

?

Help for all commands available in this mode.

help

Text describing how to get help. No actual command help is given.

Command ?

Text help describing all the first parameter options for the command.

com?

A list of commands that start with "com."

command parm?

This style of help lists all parameters beginning with "parm." (Notice that no spaces exist between parm and the ?.)

command parm<Tab>

If you press the Tab key midword, the CLI either spells the rest of this parameter at the command line or does nothing. If the CLI does nothing, it means that this string of characters represents more than one possible next parameter, so the CLI does not know which to spell out.

command parm1 ?

If a space is inserted before the question mark, the CLI lists all the next parameters and gives a brief explanation of each.

When you type the ?, IOS's CLI reacts immediately; that is, you don't need to press the Enter key or any other keys. The router also redisplays what you typed before the ?, to save you some keystrokes. If you press Enter immediately after the ?, IOS tries to execute the command with only the parameters that you have typed so far.

"command" represents any command, not the word command. Likewise, "parm" represents a command's parameter, not the word parameter.

When you type the ?, IOS's CLI reacts immediately; that is, you don't need to press the Enter key or any other keys. The router also redisplays what you typed before the ?, to save you some keystrokes. If you press Enter immediately after the ?, IOS tries to execute the command with only the parameters that you have typed so far.

"command" represents any command, not the word command. Likewise, "parm" represents a command's parameter, not the word parameter.

The information supplied by using help depends on the CLI mode. For example, when ? is typed in user mode, the commands allowed only in privileged exec mode are not displayed. Also, help is available in configuration mode; only configuration commands are displayed in that mode of operation.

IOS stores the commands that you type in a history buffer, storing ten commands by default. You can change the history size with the terminal history size x user exec command, where x is the number of commands for the CLI to recall; this can be set to a value between 0 and 256. You then can retrieve commands so that you do not have to retype the commands. Table 7-4 lists the commands used to manipulate previously typed commands.

Table 7-4 Key Sequences for Command Edit and Recall

Keyboard Command

What You Get

Up arrow or Ctrl-p

This displays the most recently used command. If it is pressed again, the next most recent command appears until the history buffer is exhausted. (The p stands for previous.)

Down arrow or Ctrl-n

If you have gone too far back into the history buffer, these keys will go forward to the more recently typed commands. (The n is for next.)

Left arrow or Ctrl-b

This moves the cursor backward in the currently displayed command without deleting characters. (The b stands for back.)

Right arrow or Ctrl-f

This moves the cursor forward in the currently displayed command without deleting characters. (The f stands for forward.)

Backspace

This moves the cursor backward in the currently displayed command, deleting characters.

Ctrl-a

This moves the cursor directly to the first character of the currently displayed command.

Ctrl-e

This moves the cursor directly to the end of the currently displayed command.

Esc-b

This moves the cursor back one word in the currently displayed command.

Esc-f

This moves the cursor forward one word in the currently displayed command.

Ctrl-r

This creates a new command prompt, followed by all the characters typed since the last command prompt was written. This is particularly useful if system messages confuse the screen and it is unclear what you have typed so far.

The key sequences in Table 7-4 are part of what Cisco calls enhanced editing mode. IOS enables enhanced editing mode by default and has for a long time. However, you can turn off these keystrokes with the no terminal editing exec command, and turn them back on with the terminal editing command. Why would you bother? Well, occasionally, you might be using a scripting language to run commands automatically on the router through a Telnet session, and enhanced editing mode sometimes can interfere with the scripts. For the exam, just remember that you can enable and disable enhanced editing mode.

0 0

Post a comment