Table Of Contents
Command Line Interface
Information About Getting Help
Information About Authorization and Command Levels (Hierarchy)
CLI Command Hierarchy
Prompt Indications
Information About CLI Help Features
Partial Help
Argument Help
[no] Prefix
Information About Navigational and Shortcut Features
Command History
Keyboard Shortcuts
Tab Completion
FTP User Name and Password
Information About Managing Command Output
Scrolling the Screen Display
Filtering Command Output
Redirecting Command Output to a File
CLI Authorization Levels
How to change from User to Viewer level authorization
How to log in with Root level authorization
Exiting Modes
How to exit from the Privileged Exec Authorization Level and revert to the Viewer Authorization Level
How to exit from the Global Configuration Mode
Information About Navigating Between Configuration Modes
Entering and Exiting Global Configuration Mode
How to enter the Global Configuration Mode
How to exit the Global Configuration Mode
Information About Interface Configuration Modes
Configuring the Physical Ports
How to enter Linecard Interface Configuration mode
Entering Fast Ethernet Line Interface Configuration Mode
How to navigate from one Interface Configuration Mode to another
The "do" Command: Executing Commands Without Exiting
How to create a CLI script
Command Line Interface
This chapter describes how to use the NME-APA module Command-Line Interface (CLI), its hierarchical structure, authorization levels and its help features. The Command-Line Interface is one of the NME-APA module management interfaces.
The CLI is accessed through a Telnet session. When you enter a Telnet session, you enter as the simplest level of user, in the User Exec mode.
The NME-APA module supports up to five concurrent CLI sessions.
•
Information About Getting Help
•
Information About Authorization and Command Levels (Hierarchy)
•
Information About CLI Help Features
•
Information About Navigational and Shortcut Features
•
Information About Managing Command Output
•
CLI Authorization Levels
•
Exiting Modes
•
Information About Navigating Between Configuration Modes
•
How to create a CLI script
Information About Getting Help
To obtain a list of commands that are available for each command mode, enter a question mark (?) at the system prompt. You also can obtain a list of keywords and arguments associated with any command using the context-sensitive help feature.
The following table lists commands you can enter to get help that is specific to a command mode, a command, a keyword, or an argument.
Table 1-1 Getting Help
Command
|
Purpose
|
abbreviated-command-entry?
|
Obtain a list of commands that begin with a particular character string.
(Do not leave a space between the command and question mark.)
|
abbreviated-command-entry<Tab>
|
Complete a partial command name.
|
?
|
List all commands available for a particular command mode
|
command?
|
List the keywords associated with the specified command.
Leave a space between the keyword and question mark.
|
command keyword?
|
List the arguments associated with the specified keyword.
Leave a space between the keyword and question mark.
|
Information About Authorization and Command Levels (Hierarchy)
When using the CLI there are two important concepts that you must understand to navigate:
•
Authorization Level—Indicates the level of commands you can execute. A user with a simple authorization level can only view some information in the system, while a higher level administrator can actually make changes to configuration.
This manual documents commands at the user exec, priviliged exec, and admin authorization levels.
•
Command Hierarchy Level—Provides you with a context for initiating commands. Commands are broken down into categories and you can only execute each command within the context of its category. For example, to configure parameters related to the Line Card, you need to be within the Linecard Interface Configuration Mode. CLI Command Hierarchy
The following sections describe the available Authorization and Command Hierarchy Levels and how to maneuver within them.
The on-screen prompt indicates both your authorization level and your command hierarchy level, as well as the assigned host name.
Note
Throughout the manual, NME-APA is used as the sample host name.
CLI Command Hierarchy
The set of all CLI commands is grouped in hierarchical order, according to the type of the commands. The first two levels in the hierarchy are the User Exec and Privileged Exec modes. These are non-configuration modes in which the set of available commands enables the monitoring of the NME-APA module, file system operations, and other operations that cannot alter the configuration of the NME-APA module.
The next levels in the hierarchy are the Global and Interface configuration modes, which hold a set of commands that control the global configuration of the NME-APA module and its interfaces. Any of the parameters set by the commands in these modes should be saved in the startup configuration, such that in the case of a reboot, the NME-APA module restores the saved configuration.
Table 1-2 shows the available CLI modes.
Table 1-2 CLI Modes
Mode
|
Description
|
Level
|
Prompt indication
|
User Exec
|
Initial mode. Also allows monitoring of the system (show commands).
|
User/Viewer
|
NME-APA>
|
Privileged Exec
|
General administration; file system manipulations and control of basic parameters that do not change the configuration of the NME-APA module.
|
• Admin
• Root
|
• NME-APA#
• NME-APA#>
|
Global Configuration
|
Configuration of general system parameters, such as DNS, hostname, and time zone.
|
• Admin
• Root
|
• NME-APA (config)#
• NME-APA (config)#>
|
Interface Configuration
|
Configuration of specific system interface parameters, such as the Line Card and the Ethernet interfaces.
|
• Admin
• Root
|
• NME-APA (config if)#
• NME-APA(config if)#>
|
Line Configuration
|
Configuration of Telnet lines.
|
• Admin
• Root
|
• NME-APA (config-line)#
• NME-APA (config-line)#>
|
When you login to the system, you have the User authorization level and enter User Exec mode. Changing the authorization level to Viewer does not change the mode. Changing the authorization level to Admin automatically moves you to Privileged Exec mode. To move to any of the configuration modes, you must enter commands specific to that mode.
A telnet session begins with a request for password, and will not continue until the proper user password is supplied. This enhances the security of the system by not revealing its identity to unauthorized people.
The list of available commands in each mode can be viewed using the question mark `?' at the end of the prompt.
The figure below, illustrates the hierarchical structure of the CLI modes, and the CLI commands used to enter and exit a mode.
Figure 1-1 CLI Command Modes
The following commands are used to enter the different configure interface modes and the Line Configuration Mode:
•
E1 interface Linecard 0
E2 interface FastEthernet 0/1 or 0/2 (line ports, NME-APA module)
E3 line vty 0
Note
Although the system supports up to five concurrent Telnet connections, you cannot configure them separately. This means that any number you enter in the line vty command (0, 1, 2, 3 or 4) acts as a 0 and configures all five connections together.
Note
In order for the auto-completion feature to work, when you move from one interface configuration mode to another, you must first exit the current interface configuration mode (as illustrated in the above figure).
Example:
This example illustrates moving into and out of configuration modes as follows:
•
Enter global configuration mode
•
Configure the NME-APA module time zone
•
Enter the Linecard Interface configuration
•
Define the link mode
•
Exit Linecard Interface configuration mode to the global configuration mode
•
Exit global configuration mode
NME-APA#configure
NME-APA(config)#clock timezone PST -10
NME-APA(config)#interface Linecard 0
NME-APA(config if)#link mode port1-port2 forwarding
NME-APA(config if)#exit
NME-APA(config)#exit
NME-APA#
Prompt Indications
The on-screen prompt indicates your authorization level, your command hierarchy level, and the assigned host name. The structure of the prompt is:
<hostname (mode-indication) level-indication>
Authorization levels are indicated as follows:
This prompt...
|
Indicates this...
|
>
|
indicates User and Viewer levels
|
#
|
indicates Admin level
|
#>
|
indicates Root level
|
Command hierarchy levels are indicated as follows:
This command hierarchy...
|
Is indicated as...
|
User Exec
|
NME-APA>
|
Privileged Exec
|
NME-APA#
|
Global Configuration
|
NME-APA (config)#
|
Interface Configuration
|
NME-APA (config if)#
|
Line Configuration
|
NME-APA (config-line)#
|
Example:
The prompt NME-APA1(config if)# indicates:
•
The name of the NME-APA module is NME-APA1
•
The current CLI mode is Interface configuration mode
•
The user has Admin authorization level
Information About CLI Help Features
CLI provides context sensitive help. Two types of context sensitive help are supported:
•
Partial help
•
Argument help
Partial Help
To obtain a list of commands that begin with a particular character string, enter the abbreviated command entry immediately followed by a question mark (?). This form of help is called partial help, because it lists only the keywords or arguments that begin with the abbreviation you entered.
Example:
The following example illustrates how typing c? displays all available arguments that start with the letter c.
NME-APA(config)#snmp-server c?
Community contact
NME-APA(config)#snmp-server c
Argument Help
To obtain a list of command's associated keywords or parameters, type a question mark (?) in place of a keyword or parameter on the command line.
Note that if <Enter> is acceptable input, the symbol <cr> represents the Enterkey.
Example:
The following example illustrates how to get a list of all arguments or keywords expected after the command snmp-server.
NME-APA(config)#snmp-server ?
community Define community string
contact Set system contact
enable Enable the SNMP agent
host Set traps destination
interface Set interface parameters
location Set system location
NME-APA(config)# snmp-server
When asking for help on a particular parameter, the system informs you of the type of data that is an accepted legal value. The types of parameters supported are:
STRING
|
When a String is expected, you can enter any set of characters or digits. If the string has a space as one of its characters, use double-quote (") marks to enclose the string.
|
DECIMAL
|
Any decimal number. Positive number is assumed, for negative numbers use the "-" symbol.
|
HEX
|
A hexadecimal number; must start with either 0x or 0X.
|
Example:
The following example illustrates the use of ? to get help on commands syntax. In this example, you can enter either the word running-config, or any name of a file, after the word copy.
NME-APA#copy ?
running-config Copy running configuration file
running-config-all Copy all running configuration files
running-config-application Copy running application configuration file
startup-config Backup the startup-config to a specified destination
STRING Source file
NME-APA#copy
[no] Prefix
Many CLI commands offer the option of adding the word no before the command to disable the feature controlled by the command or revert it to its default configuration. This notation is shown in the CLI Command Reference as [no] to denote it is optional.
For example, no service telnetd disables the telnet server. Enabling the telnet server is done by typing service telnetd.
Information About Navigational and Shortcut Features
•
Command History
•
Keyboard Shortcuts
•
Tab Completion
•
FTP User Name and Password
Command History
CLI maintains a history buffer of the most recent commands you used in the current CLI session for quick retrieval. Using the keyboard, you can navigate through your last commands, one by one, or all commands that start with a given prefix. By default, the system saves the last 30 commands you typed. You can change the number of commands remembered using the history size command.
To use the history functions, use the keys shown in Table 1-3.
Table 1-3 Keyboard Shortcuts for History Functions
Arrow
|
Shortcut
|
Description
|
Up arrow
|
Ctrl-P
|
Move cursor to the previous command with the same prefix.
|
Down arrow
|
Ctrl-N
|
Moves the cursor to the next command with the same prefix as original.
|
| |
Ctrl-L
Ctrl-R
|
Re-display the current command line.
|
Keyboard Shortcuts
The NME-APA module has several keyboard shortcuts that make it easier to navigate and use the system. The following table shows the keyboard shortcuts available.
You can get a display the keyboard shortcuts at any time by typing help bindings.
Table 1-4 Keyboard Shortcuts
Description
|
Shortcut key
|
Navigational shortcuts
|
Move cursor one character to the right.
|
CTRL-F /->
|
Move cursor one character to the left.
|
CTRL-B /<-
|
Move cursor one word to the right (forward).
|
ESC-F
|
Move cursor one word to the left (backward).
|
ESC-B
|
Move cursor to the start of the line.
|
CTRL-A
|
Move cursor to the end of the line.
|
CTRL-E
|
Editing shortcuts
|
Delete the character where the cursor is located.
|
CTRL-D
|
Delete from the cursor position to the end of the word.
|
ESC-d
|
Delete the character before the current location of the cursor.
|
Backspace
|
Delete the character before the current location of the cursor.
|
CTRL-H
|
Deletes from the cursor position to the end of the line
|
CTRL-K
|
Deletes all characters from the cursor to the beginning of the line
|
CTRL-U
|
Delete the word to the left of the cursor.
|
CTRL-W
|
Recall the last item deleted.
|
CTRL-Y
|
Completes the word when there is only one possible completion.
|
<Tab>
|
Completes the word when there is only one possible completion. (Same functionality as <Tab>.)
|
CTRL-I
|
Tab Completion
The CLI interface features tab completion. When you type in the first letters of a command and type <Tab>, the system automatically fills in the rest of the command or keyword. This feature works only when there is one command that could be possible using the starting letters.
Example:
The letters snm followed by <Tab> are completed to the command snmp-server.
NME-APA(config)#snm<Tab>
NME-APA(config)#snmp-server
If you type <Enter> instead of <Tab>, and there is no ambiguity, the system actually carries out the command which would be filled in by the rest of the word.
Example:
The following example displays how the system completes a partial (unique) command for the enable command. Because enable does not require any parameters, the system simply carries out the enable command when the user presses Enter.
NME-APA>en<Enter>
Password:
NME-APA#
FTP User Name and Password
CLI enables saving FTP user name and password to be used in FTP operations—download and upload, per session.
These settings are effective during the current CLI session.
The following example illustrates how to set FTP password and user name and the use in these settings for getting a file named config.tmp from a remote station using FTP protocol.
NME-APA#ip FTP password 1234
NME-APA#ip FTP username cisco
NME-APA#copy ftp://@10.10.10.10/h:/config.tmp myconf.txt
connecting 10.1.1.253 (user name cisco password 1234) to retrieve config.tmp
NME-APA#
Information About Managing Command Output
Some commands, such as many show commands, may have many lines of output. There are several ways of managing the command output:
•
Scrolling options—When the command output is too large to be displayed all at once, you can control whether the display scrolls line by line or refreshes the entire screen.
•
Filtering options—You can filter the output so that output lines are displayed only if they include or exclude a specified expression.
•
Redirecting to a file—You can send the output to a specified file.
Note that by default, the show commands act the same as the more commands; that is, the output is displayed interactively a single screen at a time. Use the no more (on page ) command to disable this feature so that show commands display the complete output all at one time.
Scrolling the Screen Display
The output of some show and dir commands is quite lengthy and cannot all be displayed on the screen at one time. Commands with many lines of output are displayed in chunks of 24 lines. You can choose to scroll the display line by line or refresh the entire screen. At the prompt after any line, you can type one of the following keys for the desired action:
•
<Enter>- Show one more line
•
<Space>- Show 24 more lines (a new chunk)
•
<g>- Stop prompting for more
•
<?>- Display a help string showing possible options
•
Any other key- Quit showing the file
Filtering Command Output
You can filter the output of certain commands, such as show, more, and dir, so that output lines are displayed only if they include or exclude a specified expression. The filtering options are as follows:
•
include—Shows all lines that include the specified text.
•
exclude—Does not show any lines that include the specified text.
•
begin—Finds the first line that includes the specified text, and shows all lines starting from that line. All previous lines are excluded.
The syntax of filtered commands is as follows:
•
<command> | include <expression>
•
<command> | exclude <expression>
•
<command> | begin <expression>
Following is an example of how to filter the show version command to display only the last part of the output, beginning with the version information.
NME-APA# show version | include revision
Redirecting Command Output to a File
You can redirect the output of commands, such as show, more, and dir, to a file. When writing the output of these commands to a file, you can specify either of the following options:
•
redirect—The new output of the command will overwrite the existing contents of the file.
•
append—The new output of the command will be appended to the existing contents of the file.
The syntax of redirection commands is as follows:
•
<command> | redirect <file-name>
•
<command> | append <file-name>
Following is an example of how to do the following:
•
Filter the more command to display from a csv user file only the gold package users.
•
Redirect that output to a file named current_gold_users. The output should not overwrite existing entries in the file, but should be appended to the end of the file.
NME-APA# more users_10.10.2004 include gold | append current_gold_users
CLI Authorization Levels
The NME-APA module has four authorization levels, which represent the user access permissions. When you initially connect to the NME-APA module, you automatically have the most basic authorization level, that is User, which allows minimum functionality.
To monitor the system, you must have Viewer authorization, while to perform administrative functions on the NME-APA module, you must have Admin or Root authorization. A higher level of authorization is accessed by logging in with appropriate password, as described in the procedures below.
In each authorization level, all the commands of the lower authorization layers are available in addition to commands that are authorized only to the current level.
The following CLI commands are related to authorization levels:
•
enable
•
disable
Each authorization level has a value (number) corresponding to it. When using the CLI commands, use the values, not the name of the level, as shown in the following table.
Table 1-5 Authorization Levels
Level
|
Description
|
Value
|
Prompt
|
User
|
Password required. This level enables basic operational functionality.
|
0
|
>
|
Viewer
|
Password required. This level enables monitoring functionality. All show commands are available to the Viewer authorization level, with the exception of those that display password information.
|
5
|
>
|
Admin
|
Password required. For use by general administrators, the Admin authorization level enables configuration and management of the NME-APA module.
|
10
|
#
|
Root
|
Password required. For use by technical field engineers, the Root authorization level enables configuration of all advanced settings, such as debug and disaster recovery. The Root level is used by technical engineers only.
|
15
|
#>
|
How to change from User to Viewer level authorization
A telnet session begins with a request for password, and will not continue until the proper user password is supplied. This enhances the security of the system by not revealing its identity to unauthorized people.
Step 1
From the NME-APA> prompt, type enable 5 and press Enter.
The system prompts for a password by showing the prompt Password:
Step 2
Type in the password for the Viewer level and press Enter.
Note that the password is an access-level authorization setting, not an individual user password.
The system prompt NME-APA> does not change when you move from User to Viewer level.
How to log in with Root level authorization
Step 1
Initiate a telnet connection.
Step 2
A Password: prompt appears. Type in the user level password and press Enter.
The NME-APA> prompt appears.
You now have user level authorization.
Step 3
From the NME-APA> prompt, type enable 15 and press Enter.
The system prompts for a password by showing the prompt Password:
Step 4
Type in the password for the Root level and press Enter.
Note that the password is an access-level authorization setting, not an individual user password.
The system prompt changes to NME-APA#> to show you are now in Root level.
This example illustrates how to change the authorization level from User to Root, and then revert back to Viewer. No password is required for moving to a lower authorization level.
NME-APA>enable 15
Password: <Cisco>
NME-APA#>disable
NME-APA>
Exiting Modes
This section describes how to revert to a previous mode.
•
To exit from one authorization level to the previous one, use the disable command.
•
To exit from one mode to another with the Admin authorization level (these are the various configuration modes), use the exit command.
How to exit from the Privileged Exec Authorization Level and revert to the Viewer Authorization Level
Step 1
At the NME-APA# prompt, type disable and press Enter.
The NME-APA> prompt for the Viewer and User Exec authorization level appears.
How to exit from the Global Configuration Mode
Step 1
At the NME-APA(config)# prompt, type exit and press Enter.
The appropriate prompt for the previous mode appears.
Information About Navigating Between Configuration Modes
•
Entering and Exiting Global Configuration Mode
•
Information About Interface Configuration Modes
Entering and Exiting Global Configuration Mode
•
How to enter the Global Configuration Mode
•
How to exit the Global Configuration Mode
How to enter the Global Configuration Mode
Step 1
At the NME-APA# prompt, type configure and press Enter.
The NME-APA (config)# prompt appears.
How to exit the Global Configuration Mode
Step 1
At the NME-APA(config)# prompt, type exit and press Enter.
The NME-APA# prompt appears.
Information About Interface Configuration Modes
The components that are configured by the Interface Configuration Modes are:
•
Card
–
Linecard—Interface Linecard 0
The Linecard interface configures the main functionality of viewing and handling traffic on the line.
•
Ports
–
Configuring the Physical Ports
•
Telnet
–
Line Configuration Mode—Line vty 0
The Line Configuration Mode enables you to configure Telnet parameters.
Configuring the Physical Ports
The NME-APA module contains the following physical port interfaces:
•
Fast Ethernet:
Interface FastEthernet 0/1 or 0/2
The FastEthernet Interface mode configures the settings for the FastEthernet interface to the Internet traffic on the wire. Each of the two ports can be set individually.
The following commands are used to configure the Fast Ethernet line ports:
–
bandwidth
–
queue
Note
You must specify the slot number/interface number when referencing any interface. The slot number is always 0, and the interfaces are numbered as follows:
Fast Ethernet Line Interfaces: 1,2
How to enter Linecard Interface Configuration mode
The following procedure is for entering Line Card Interface Configuration mode. The procedures for entering the other interfaces are the same except for the interface command as described above.
Step 1
To enter Global Configuration Mode, at the NME-APA# prompt, type configure and press Enter.
The NME-APA(config)# prompt appears.
Step 2
Type interface Linecard 0 and press Enter.
The NME-APA(config if)# prompt appears.
Step 3
To return to Global Configuration Mode, type exit and press Enter.
The NME-APA(config)# prompt appears.
Step 4
To exit Global Configuration Mode, type exit and press Enter.
The NME-APA# prompt appears.
Entering Fast Ethernet Line Interface Configuration Mode
•
How to enter the FastEthernet Interface Configuration Mode
How to enter the FastEthernet Interface Configuration Mode
Step 1
To enter Global Configuration Mode, at the NME-APA# prompt, type configure and press Enter.
The NME-APA(config)# prompt appears.
Step 2
Type interface FastEthernet [0/1|0/2] and press Enter.
The NME-APA(config if)# prompt appears.
The following example shows how to enter Configuration Mode for the FastEthernet Interface number 1.
NME-APA(config)#interface FastEthernet 0/1
NME-APA(config if)#
How to navigate from one Interface Configuration Mode to another
Step 1
Type Exit.
You are returned to the Global Configuration Mode.
Step 2
Type the appropriate command to enter a different Interface Configuration Mode.
The "do" Command: Executing Commands Without Exiting
There are three configuration command modes:
•
Global configuration mode
•
Interface configuration mode
•
Line configuration mode
When you are in one of these configuration modes, it is possible to execute an EXEC mode command (such as a show command) or a privileged EXEC (such as show running-config) without exiting to the relevant command mode. Use the 'do' command for this purpose.
How to execute an exec mode command from a configuration command mode
Step 1
At the NME-APA(config)# (or NME-APA(config if)#) prompt, type do <command>.
The specified command executes without exiting to the appropriate exec command mode.
The following example shows how to display the running configuration while in interface configuration mode.
NME-APA(config if#) do show running-config
How to create a CLI script
The CLI scripts feature allows you to record several CLI commands together as a script and play it back. This is useful for saving repeatable sequence of commands, such as software upgrade. For example, if you are configuring a group of NME-APA modules and you want to run the same configuration commands on each platform, you could create a script on one platform and run it on all the other NME-APA modules. The available script commands are:
•
script capture
•
script stop
•
script print
•
script run
Step 1
At the NME-APA# prompt, type script capture sample1.scr where sample1.scr is the name of the script.
Step 2
Perform the actions you want to be included in the script.
Step 3
Type script stop.
The system saves the script.
The following is an example of recording a script for defining users.
NME-APA#script capture users.scr
NME-APA#configure
NME-APA(config)#username John privilege 15 password BfgVxsm
NME-APA(config)#username Kathy privilege 10 password Muyiop
NME-APA(config)#aaa authentication login default local enable
NME-APA(config)#exit
NME-APA#copy running-config startup-config
Writing general configuration file to temporary location...
Backing-up general configuration file...
Copy temporary file to final location...
NME-APA#script stop
NME-APA#