Using Command-Line Editing

This section provides information about the command-line editor.

Basic Editing

Here are a few basic command-line editing notes:

Command-Line Editing Keys

You can use several keys to edit the command line. Table 7 defines the keys for editing the command line. Arrow keys functions only on ANSI-compatible terminals, such as VT100s.

Table 7: Command-Line Editing Keys

Key(s)

Function

Delete or Backspace

Removes characters to left of cursor

Left Arrow

Moves cursor one character to left

Right Arrow

Moves cursor one character to right

Ctrl+a

Moves cursor to beginning of command line

Ctrl+b

Moves cursor back one character

Ctrl+d

Deletes character at cursor

Ctrl+e

Moves cursor to end of command line

Ctrl+f

Moves cursor forward one character

Ctrl+h

Deletes character to left of cursor

Ctrl+k

Deletes all characters from cursor to end of command line

Ctrl+l

Redisplays system prompt and command line

Ctrl+o

Toggles overwrite/insert mode

Ctrl+q

Resumes a Telnet or console session; use if the Telnet or console session appears frozen or unresponsive

Ctrl+s

Suspends a Telnet or console session

Ctrl+t

Transposes character to left of cursor with character located at cursor

Ctrl+u

Deletes entire command line

Ctrl+v

Allows the “ ?” character to be used as a character instead of as a request for help

Ctrl+w

Deletes the previous word

Ctrl+x

In all modes, reboots the system. This feature is useful if a command is taking a prolonged time to complete and hangs the console. The command has no effect if you access the system through Telnet.

Set the boot option flag by using the service ctrl-x-reboot command from Global Configuration mode.

Ctrl+y

Recalls most recent entry from delete buffer; recalled characters overwrite or are inserted in current line depending on overwrite/insert toggle

Ctrl+z

In all modes except User Exec mode, executes any command typed immediately before the command sequence and then changes the mode to Privileged Exec mode. In User Exec mode, only executes any command typed immediately before the command sequence.

Esc+b

Moves cursor back one word

Esc+Backspace

Deletes previous word

Esc+d

Deletes current or next word

Esc+f

Moves cursor forward one word

Command History Keys

The CLI maintains two separate command histories. The first command history maintains only Exec mode commands. The second history maintains all commands entered in any of the configuration modes. The appropriate history will automatically be restored as you transition between Global Configuration mode and Exec mode.

Table 8 defines the keys related to command history. Arrow keys functions only on ANSI-compatible terminals, such as VT100s.

Table 8: Command History Keys

Key

Function

Up Arrow or Ctrl+p

Recalls commands in history buffer, starting with most recent command. Repeat key sequence to recall successively older commands.

Down Arrow or Ctrl+n

Returns to more recent commands in history buffer after recalling commands with Up Arrow or Ctrl+p. Repeat key sequence to recall successively more recent commands.

Ctrl+r

Begin a reverse search for a previously entered string in the history buffer by providing a character string when prompted. Enter Ctrl+r to continue searching. Ctrl+h or Del deletes the last character in the string and starts a search on the new string.

Pagination Keys

If the system needs to display more text than you can fit on the screen, the output pauses and the --More-- prompt appears. Table 9 defines the pagination keys that you can use when the --More-- prompt appears. For more information, see The - -More- - Prompt.

Table 9: Pagination Keys

Key

Function

Enter

Scrolls down one more line

Spacebar

Displays one more screen

+

Displays all output lines that contain the text string

Displays all output lines that do not contain the text string

/

Displays all output lines starting at the first line that contains the text string

Any other key

Aborts output and returns you to command prompt