Exploring Special Characters and Keystroke Shortcuts

Table 2-7 lists the characters that have special meaning in Cisco NX-OS text strings and should be used only in regular expressions or other special contexts.

  

Table 2-7 Special Characters

Character

Description

%

Percent

#

Pound, hash, or number

โ€ฆ

Ellipsis

|

Vertical bar

< >

Less than or greater than

[ ]

Brackets

{ }

Braces

The output from show commands can be lengthy and cumbersome. The Cisco NX-OS software provides the means to search and filter the output so that you can easily locate information. The searching and filtering options follow a pipe character (|) at the end of the show command, as shown in Example 2-8.

Example 2-8 Pipe (|) Character Filtering

Click here to view code image

N9K#
show running-config
 |
include management

vrf context management
  vrf member management
N9K#

Table 2-8 lists command key combinations that can be used in both EXEC and configuration modes.

Table 2-8 Keystroke Shortcuts

Keystrokes

Description

Ctrl-A

Moves the cursor to the beginning of the line.

Ctrl-B

Moves the cursor one character to the left. When you enter a command that extends beyond a single line, you can press the left arrow key or the Ctrl-B key combination repeatedly to scroll back toward the system prompt and verify the beginning of the command entry, or you can press the Ctrl-A key combination.

Ctrl-C

Cancels the command and returns to the command prompt.

Ctrl-D

Deletes the character at the cursor.

Ctrl-E

Moves the cursor to the end of the line.

Ctrl-F

Moves the cursor one character to the right.

Ctrl-G

Exits to the previous command mode without removing the command string.

Ctrl-K

Deletes all characters from the cursor to the end of the command line.

Ctrl-L

Redisplays the current command line.

Ctrl-N

Displays the next command in the command history.

Ctrl-O

Clears the terminal screen.

Ctrl-P

Displays the previous command in the command history.

Ctrl-R

Redisplays the current command line.

Ctrl-T

Transposes the character under the cursor with the character located to the right of the cursor. The cursor is then moved to the right one character.

Ctrl-U

Deletes all characters from the cursor to the beginning of the command line.

Ctrl-V

Removes any special meaning for the following keystroke. For example, press Ctrl-V before entering a question mark (?) in a regular expression.

Ctrl-W

Deletes the word to the left of the cursor.

Ctrl-X, H

Lists the history of commands you have entered. When using this key combination, press and release the Ctrl and X keys together before pressing H.

Ctrl-Y

Recalls the most recent entry in the buffer (press keys simultaneously).

Ctrl-Z

Ends a configuration session and returns you to EXEC mode. When used at the end of a command line in which a valid command has been typed, the resulting configuration is first added to the running configuration file.

Up arrow key

Displays the previous command in the command history.

Down arrow key

Displays the next command in the command history.

Right arrow key

Left arrow key

Moves your cursor through the command string, either forward or backward, allowing you to edit the current command.

?

Displays a list of available commands.

Tab

Completes the word for you after you enter the first characters of the word and then press the Tab key. All options that match are presented.

Use tabs to complete the following items:

Command namesScheme names in the file systemServer names in the file systemFilenames in the file system

You can display all the options following a pipe character using the CLI context-sensitive help (?) facility, as shown in Example 2-9.

Example 2-9 Pipe and Context-Sensitive Help

Click here to view code image

N9K#
show running-config
ย | ?
ย ย awkย ย ย ย ย ย ย ย ย ย Mini AWK
ย ย cutย ย ย ย ย ย ย ย ย ย Print selected parts of lines.
ย ย diffย ย ย ย ย ย ย ย ย Show difference between current and previous invocation (creates
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย temp files: remove them with ‘diff-clean’ command and dont use it on
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย commands
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย with big outputs, like ‘show tech’!)
ย ย egrepย ย ย ย ย ย ย ย Egrep – print lines matching a pattern
ย ย emailย ย ย ย ย ย ย ย Email command output
ย ย grepย ย ย ย ย ย ย ย ย Grep – print lines matching a pattern
ย ย headย ย ย ย ย ย ย ย ย Display first lines
ย ย humanย ย ย ย ย ย ย ย Output in human format
ย ย jsonย ย ย ย ย ย ย ย ย Output in json format
ย ย json-prettyย ย Output in json pretty print format
ย ย lastย ย ย ย ย ย ย ย ย Display last lines
ย ย lessย ย ย ย ย ย ย ย ย Filter for paging
ย ย no-moreย ย ย ย ย ย Turn-off pagination for command output
ย ย sectionย ย ย ย ย ย Show lines that include the pattern as well as the subsequent lines
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย that are more indented than matching line
ย ย sedย ย ย ย ย ย ย ย ย ย Stream Editor
ย ย sortย ย ย ย ย ย ย ย ย Stream Sorter
ย ย trย ย ย ย ย ย ย ย ย ย ย Translate, squeeze, and/or delete characters
ย ย uniqย ย ย ย ย ย ย ย ย Discard all but one of successive identical lines
ย ย vshย ย ย ย ย ย ย ย ย ย The shell that understands cli command
ย ย wcย ย ย ย ย ย ย ย ย ย ย Count words, lines, characters
ย ย xmlย ย ย ย ย ย ย ย ย ย Output in xml format (according to .xsd definitions)
ย ย xmlinย ย ย ย ย ย ย ย Convert CLI show commands to their XML formats
ย ย xmloutย ย ย ย ย ย ย Output in xml format (according to the latest .xsd version)
ย ย beginย ย ย ย ย ย ย ย Begin with the line that matches
ย ย countย ย ย ย ย ย ย ย Count number of lines
ย ย endย ย ย ย ย ย ย ย ย ย End with the line that matches
ย ย excludeย ย ย ย ย ย Exclude lines that match
ย ย includeย ย ย ย ย ย Include lines that match

N9K#

Pressing the Tab key completes the word for you. If there is ambiguity and there are multiple commands possible, the Tab key lists all the possible options that match, as shown in Example 2-10.

Example 2-10 The Tab Key

Click here to view code image N9K#
show interface
ย s<
Tab
>
server-infoย ย ย ย snmp-ifindexย ย ย ย statusย ย ย ย ย ย switchport
N9K#
N9K#
conf
<Tab>
N9K# configure

,


Leave a Reply

Your email address will not be published. Required fields are marked *