Basics – Entering Commands

A CLI command is a series of keywords and arguments. Keywords identify a command, and arguments specify configuration parameters. For example, in the command “show interfaces status gi1/1/5“, show, interfaces and status are keywords, gi is an argument that specifies the interface type, and [application-specific] is an argument that specifies the port.

To enter commands that require parameters, enter the required parameters after the command keyword. For example, to set a password for the administrator, enter: console(config)# username admin password smith

Help information can be displayed in the following ways:

  • Keyword Lookup —The character ? is entered in place of a command. A list of all valid commands and corresponding help messages are displayed.
  • Partial Keyword Lookup —A command is incomplete and the character ? is entered in place of a parameter. The matched parameters for this command are displayed.

The following describes features that assist in using the CLI:

Terminal Command Buffer

Every time a command is entered in the CLI, it is recorded on an internally managed Command History buffer. Commands stored in the buffer are maintained on a First In First Out (FIFO) basis.These commands can be recalled, reviewed, modified, and reissued. This buffer is not preserved across device resets. The keys that can be used to access the history buffer are described in Table 1.

By default, the history buffer system is enabled, but it can be disabled at any time. For information about the command syntax to enable or disable the history buffer, see the history command.

There is a standard default number of commands that are stored in the buffer. The standard number of 10 commands can be increased to 256. By configuring 0, the effect is the same as disabling the history buffer system. For information about the command syntax for configuring the command history buffer, see the history size command.

To display the history buffer, see show history command.

Negating the Effect of Commands

For many configuration commands, the prefix keyword “no” can be entered to cancel the effect of a command or reset the configuration to the default value. This guide describes the negation effect for all applicable commands.

Command Completion

If the command entered is incomplete, invalid, or has missing or invalid parameters, an appropriate error message is displayed.

To complete an incomplete command, press the <Tab> button. If the characters already entered are not enough for the system to identify a single matching command, press “?” to display the available commands matching the characters already entered.

Incorrect or incomplete commands are automatically re-entered next to the cursor. If a parameter must be added, the parameter can be added to the basic command already displayed next to the cursor. The following example indicates that the command interface requires a missing parameter.

(config)#interface
%missing mandatory parameter

Keyboard Shortcuts

The CLI has a range of keyboard shortcuts to assist in entering the CLI commands.

The following table describes these shortcuts:

 Table 1:    Keyboard Keys

Up-arrow keyRecalls commands from the history buffer, beginning with the most recent command. Repeat the key sequence to recall successively older commands.
Down-arrow keyReturns the most recent commands from the history buffer after recalling commands with the up arrow key. Repeating the key sequence will recall successively more recent commands.
Ctrl+AMoves the cursor to the beginning of the command line.
Ctrl+EMoves the cursor to the end of the command line.
Ctrl+Z / EndReturns back to the Privileged EXEC mode from any mode.
Backspace keyMoves the cursor back one space.


Was this article helpful?

Related Articles

Leave A Comment?