CSS Command Reference (Software Version 7.40)
Using the Command-Line Interface
Downloads: This chapterpdf (PDF - 265.0KB) The complete bookPDF (PDF - 5.06MB) | Feedback

Using the Command-Line Interface

Table Of Contents

Using the Command-Line Interface

CLI Modes

User Mode

SuperUser Mode

Configuration Modes

Logging into and Exiting the CLI

Using CLI Commands

Syntax Conventions

Variable Argument Conventions

Entering Multiple Commands

CLI Command Keyboard Shortcuts

Using grep

Understanding CLI Syntax Checking and Error Messages

Getting CLI Help

Question Mark (?)

Tab Key

Help Command

User-Defined Variables

CSS Scripts

Writing and Running CLI Scripts

CSS-Provided Scripts

Profile Scripts


Using the Command-Line Interface


The command-line interface (CLI) is a line-oriented user interface that has a set of commands for configuring, managing, and monitoring the CSS. To help you use these commands, this chapter provides you with information on:

CLI Modes

Logging into and Exiting the CLI

Using CLI Commands

Getting CLI Help

User-Defined Variables

CSS Scripts

For information on specific CLI commands, refer to Chapter 2, CLI Commands.

CLI Modes

The CLI provides the following modes:

User

SuperUser

Configuration and its subordinate modes

The following sections describe each of these modes:

User Mode

SuperUser Mode

User Mode

When the CSS administrator assigns a username with User permission, this permission level allows you to log in to User mode on the CSS. This mode is identified by a prompt that ends with a greater-than symbol (>). Within this mode, you can use a limited set of commands to monitor and display CSS parameters but not change them.

For information on the commands you can use in User mode, refer to Chapter 2, CLI Commands, "General Commands".

SuperUser Mode

When the CSS administrator assigns a username with SuperUser permission, this permission level allows you to log in to SuperUser mode on the CSS. This mode is identified by a prompt that ends with a pound sign (#).

Within this mode, you can use the commands to maintain the CSS and to access global configuration mode to configure the CSS. You can also use User-mode commands in SuperUser mode.

For information on the commands you can use in SuperUser mode, refer to Chapter 2, CLI Commands, "General Commands".

Configuration Modes

When you log in to the CSS as a SuperUser, you can use the configure command to access global configuration mode. This mode is identified by a (config) prompt. Within this mode, you can use its set of commands to configure the CSS and access its subordinate configuration modes.

When you access any of the subordinate configuration modes, the CSS appends the mode name to the (config) prompt. For example, when you access owner mode from global configuration mode, the prompt changes to (config-owner [owner_name]).

Each mode has its own set of commands. Many of the modes have commands allowing you to access other related modes. When you switch modes, you exit the current mode and enter the new mode. For example, from interface configuration mode, you can move directly to ACL, circuit, DQL, EQL, group, owner, RMON alarm, RMON event, RMON history, service, or URQL configuration mode.

To exit any configuration mode and return to SuperUser mode, press Ctrl-Z.

For information on the commands you can use in global configuration mode and its subordinate modes, including the configure command, refer to Chapter 2, CLI Commands.

Logging into and Exiting the CLI

When the CSS completes the system boot, the CLI starts automatically and is available for use. To log in to the CSS and access the CLI, use a terminal device connected to the Console port on the CSS.

Instead of using the Console port, you can also use Telnet. For more information on terminal settings for Telnet use, refer to the Cisco 11500 Series Content Services Switch Hardware Installation Guide for the 11500 series CSS.

You can use the CLI from any terminal device that is compatible with ANSI, VT52, or VT100 characteristics. ANSI and VT100 devices let you use cursor-control and cursor-movement keys: left-arrow, up-arrow, down-arrow, right-arrow, Delete, and Backspace. The CLI senses the use of cursor-control keys and automatically uses the optimal device characteristics.


Note The first time you log in to the CLI, use the default username of admin and the default password of system.


To exit from the CLI, use the exit command from SuperUser mode. If you are currently in one of the configuration modes and want to exit the CLI, press Ctrl-Z to return to SuperUser mode, and then use the exit command.

Using CLI Commands

This section provides information on:

Command conventions for syntax used in this book and variable argument conventions

Entering multiple commands

CLI keyboard shortcuts when you are using the CLI

Using grep

Understanding CLI syntax checking and error messages

Syntax Conventions

To help you identify the parts of a CLI command, Chapter 2, CLI Commands, uses conventions to show the syntax of commands. Table 1-1 lists these syntax conventions and their descriptions.

Table 1-1 Syntax Conventions

Syntax Convention
Description

boldface

Identifies commands and options you must enter exactly as shown.

italics

Identifies variables you must supply. For more information on variable arguments, see the next section.

... (ellipsis)

Identifies the continuation of the command.

| (vertical bar)

Identifies mutually exclusive choices. Note that you can also use the | character as a pipe with grep. For more information on grep, see the "Using grep" section.

[ ] (square brackets)

Encloses required keywords or variables.

{ } (braces)

Encloses optional options or variables.



Note Do not enter the ellipsis, brackets, vertical bar, or braces in command lines. This guide uses these symbols only to show the types of entries.


CLI commands and options are in lowercase and are case-sensitive. For example, when you enter the configure command, enter it all in lowercase, not CONFIGURE or Configure. Text entries you create are also case-sensitive. For example, if you set a username to Sys1, enter it exactly, not sys1 or SYS1.


Note When Cisco Systems makes syntax changes to existing commands, the CSS automatically updates the startup-config file with the most recent changes when you upgrade the software on the CSS. For example, the CSS changes the web-mgmt state enabled command to the no restrict xml command.


Variable Argument Conventions

Some commands require variable arguments for information you must supply. CLI command variable arguments generally consist of integers, quoted and unquoted text strings, IP addresses and subnet masks, host names, Media Access Control (MAC) addresses, interfaces, stack layers, and timeslots.

Table 1-2 lists the types of arguments you may encounter and the conventions to enter this information.

Table 1-2 Variable Arguments 

Variable Argument
Convention

host names

Enter host names in mnemonic host-name format. For example:

myhost.mydomain.com

integers

Enter only whole numbers with no decimal points. For example:

200

Internet Protocol (IP) Addresses and Subnet Masks

Enter IP addresses and subnet masks in dotted-decimal notation. This notation is four groups of up to three decimal numbers, separated by periods. Each group has a maximum number of 255. For example:

192.168.11.1
255.255.255.0

For some arguments, you can also use Classless Interdomain Routing (CIDR) notation for subnet masks. For example:

/24 is equivalent to 255.255.255.0

/16 is equivalent to 255.255.0.0

Interface

Interface entries specify physical interfaces present in the CSS. Enter interfaces in groups of one to three characters. The format depends on your CSS.

For the 11501 CSS, enter:

interface type-port

For example:

e2

For the 11503 or 11506 CSS, enter:

slot/port

For example:

1/1
13/5

MAC addresses

Enter MAC addresses as six groups of two hexadecimal numbers each, separated by hyphens. The alphabetic characters are not case-sensitive. For example:

07-77-25-C9-af-13

stack layers

Stack layer entries specify layers within interface stacks. Enter one of the following:

circuit - An CSS circuit

physical - The physical interface

text strings: quoted

Enter quoted text strings as text and spaces enclosed in quotation marks. For example:

"Server lab A-3"

text strings: unquoted

Enter unquoted text strings as contiguous alphanumeric characters without spaces or quotation marks. For example:

Sys_1
MyLink

Entering Multiple Commands

You can enter multiple commands on a single command line by separating them with the semicolon (;) character. For example:

copy running-config startup-config;archive startup-config

CLI Command Keyboard Shortcuts

Table 1-3 lists the CLI keyboard shortcuts to help you enter and edit command lines.

Table 1-3 CLI Command Keyboard Shortcuts 

Action
Keyboard Shortcut

Cancel the current operation, additional display of MORE output, or delete the current line.

Ctrl-C

Capitalize the character at the cursor.

Esc-C

Change:

The word at the cursor to lowercase.

Esc-L

The word at the cursor to uppercase.

Esc-U

Delete:

A character at the cursor.

Ctrl-D

A character to the left of the cursor.

Ctrl-H, Delete, or Backspace

All characters from the cursor to the beginning of the line.

Ctrl-U or Ctrl-X

All characters from the cursor to the end of the line.

Ctrl-K

All characters from the cursor to the end of the word.

Esc-D

The word to left of the cursor.

Ctrl-W or Esc-Backspace

Display the buffer's:

Next line.

Ctrl-N or Down Arrow

Previous line.

Ctrl-P or Up-Arrow

Display MORE output:

Current line number.

l or L

Exit from MORE output.

q, Q, or Ctrl-C

Go to a line number in the buffer. The default is the last line. To go to a specific line, enter the line number before pressing the g or G key. For example, enter 3G to go to the third line in the buffer.

g or G

Help screen.

h or H

Next additional screen. The default is one screen. To display more than one screen, enter a number before pressing the Spacebar key.

Spacebar

Next line. The default is one line. To display more than one line, enter the number before pressing the Return key.

Return

Previous line. To display more than one line, enter the number before pressing Up Arrow key.

Up Arrow

Previous screen. The default is one screen. To display more than one screen, enter a number before pressing the b, B, or Ctrl-B key.

b, B, or Ctrl-B

Redraw screen.

r, R, or Ctrl-L

Search forward for regular_expression.

/regular_expression

Search backward for regular_expression.

?regular_expression

Enter an Enter or Return key character.

Ctrl-M

Enter a global configuration mode command from any mode.

@command

Expand the command or abbreviation.

Ctrl-I or Tab

Move the cursor:

One character to the left (back).

Ctrl-B or Left Arrow

One character to the right (forward).

Ctrl-F or Right Arrow

One word to the left (back), to the beginning of current or previous word.

Esc-B

One word to the right (forward), to the end of the current or next word.

Esc-F

To the beginning of the line.

Ctrl-A

To the end of the line.

Ctrl-E

Redisplay the current line.

Ctrl-L or Ctrl-R

Return to the SuperUser mode from any configuration mode.

Ctrl-Z

Toggle:

Line logging suppression.

Esc-S

MORE support.

Esc-M

Transpose a character at the cursor with a character to left of the cursor.

Ctrl-T


Using grep

You can apply grep to any CLI commands with the (|) pipe character. For example:

show running-config|grep IP

show log log.file|grep -i ip

The usage of grep is:

grep [-[i|v|s]] keyword

The options are:

i - Case-insensitive search

v - Displays all lines not containing keyword

s - Displays all lines following match

Understanding CLI Syntax Checking and Error Messages

If you enter an invalid or incomplete command, the CLI responds with a pointer (^) and an error message. The following example shows the CLI response when you enter an invalid command:

# bobo
  ^
%% Invalid input detected at `^' marker.

The following example shows the CLI response when you enter an incomplete command:

(config)# service 
                 ^
%% Insufficient arguments to form command.

Getting CLI Help

The CLI provides several types of context-sensitive help:

Question mark

Tab key

Help commands

Question Mark (?)

The question mark (?) character allows you to get the following type of help about a command at the command line:

Question Mark Usage
Command Help Type

? at command prompt

All commands for that mode

command ?

All options for a command

command option ?

All arguments for a command and its option

command-abbrev?

All commands that begin with specific letters


If the CLI is unable to provide question mark support, a bell sounds when you enter the key.

Tab Key

When you press the Tab key or Ctrl-I at the end of a unique command or option abbreviation, the CLI completes the command or options for you. For example:

#al<Tab> 
#alias

Pressing the Tab key or Ctrl-I keys also completes an option up to the point where it is unique. If multiple commands have the same abbreviation that you entered, the CLI lists all of these commands.


Note If the CLI is unable to provide complete Tab key support, a bell sounds when you enter the key.


Help Command

You can display a series of help topics by entering the help command at the CLI prompt, or display help information about specific topics including the following:

Entering commands - Use the help commands command.

Configuration files - Use the help configuration command.

Keyboard shortcuts - Use the help keys command.

Navigating modes - Use the help modes command.

Variables - Use the help variables command.

User-Defined Variables

The CLI supports user-defined variables for use from the command line and from scripts. There are two types of variables: character and numeric. If you assign the variable with all integers and no spaces, it is a numeric variable. If you assign the variable with any text characters and spaces, it is a character variable.

To create or manipulate variables, refer to the set, input, modify, and var-shift commands in Chapter 2, CLI Commands.

CSS Scripts

CSS scripts include scripts that you write using CLI commands, scripts provided with your CSS, and special scripts containing user profile information. For detailed information about writing scripts, refer to the Content Services Switch Basic Configuration Guide.

Writing and Running CLI Scripts

Use the CLI script record command to record command entries in a script file. You can also use an ASCII text editor to write CLI scripts (for example, Microsoft Notepad, MS-DOS Edit, UNIX PICO, or EMACS). Do not use a word processing program such as Microsoft Word or WordPad.

The CLI provides the following script commands:

echo

input

endbranch

modify

exit

pause

function

set

if

while


For more information about these commands and their options, refer to Chapter 2, CLI Commands.

When you finished creating the file, press Ctrl-C to exit the script record command mode. If you used a text editor, save the script by entering any filename and extension with a maximum of 32 characters. Then, use the copy command to move the script file to the CSS.

To run a CLI script, use the script play command.

CSS-Provided Scripts

The CSS contains scripts that CSS provides to assist you with tasks, for example, CLI setup and upgrade. To see a list of CSS-provided scripts, use the show script command. To run a CLI script, use the script play command.

The CSS also provides aliases to run the scripts. To see a list of all aliases, refer to the show aliases command.

Profile Scripts

When a user logs into the CSS, the CSS runs a profile script. These scripts contain commands that are exclusive to the current CLI session. The CSS performs the folllowing tasks:

A default-profile script for everyone

A user-profile script for the matching username

After you log in to the CSS, you can modify your profile by changing the CLI prompt, terminal parameters, or expert mode setting, or by adding alias commands. The CSS keeps these changes in a temporary running profile until you exit the CLI.

To permanently save any running profile changes to your user profile, do either of the following:

Copy the running profile to your user-profile script with the copy profile user-profile command.

Wait until you exit the CLI, and enter a y in response to the prompt and query to save your profile changes; if you enter an n, your profile changes are discarded.

For more information on changing your profile, refer to the Content Services Switch Administration Guide.