The command line interface is a man-machine interface that is provided by the shell subsystem to configure and use the device. Through the command line interface, users can input and edit commands to perform the required configuration tasks, and they can also query the system information and learn the system operation status.
The command line interface provides the following functions for the users:
- System help information management
- System command inputting and editing
- History command management
- Terminal display system management
Command Line Online Help
The command line provides the following types of online help:
- Help
- Full help
- Partial help
Through the above types of online help, users can obtain various help information. The following gives some examples.
- To obtain a brief description of the online help system, run the help command in any command mode.
Hostname#help
Help may be requested at any point in a command by entering
a question mark '?'. If nothing matches, the help list will
be empty and you must backup until entering a '?' shows the
available options.
Two styles of help for command are provided:
1. Full help is available when you are ready to enter a
command argument (e.g. 'show ?') and describes each possible
argument.
2. Partial help is provided when an abbreviated argument is entered
and you want to know what arguments match the input
(e.g. 'show pr?'.)
And "Edit key" usage is the following:
CTRL+A -- go to home of current line
CTRL+E -- go to end of current line
CTRL+U -- erase all character from home to current cursor
CTRL+K -- erase all character from current cursor to end
CTRL+W -- erase a word on the left of current cursor
CTRL+R -- erase a word on the right of current cursor
CTRL+D,DEL -- erase a character on current cursor
BACKSPACE -- erase a character on the left of current cursor
CTRL+B,LEFT -- current cursor backward a character
CTRL+F,RIGHT -- current cursor forward a character |
- To list all commands and their brief description in any command mode, type "?" in the command mode.
Hostname#configure terminal
Hostname(config)#?
|
aaa
access-list
alarm
arl
arp
arp-security
autosave
banner
bgp
cable-diagnostics
|
Authentication, Authorization and Accounting
Access List
Set alarm option of system
Address translation item
Set a static ARP entry
To CPU arp security
Auto save the startup configuration
Define a login banner
BGP information
Cable Diagnostics on physical interface
|
- Type a command followed by "?", and all sub-commands that can be executed in the current mode are displayed.
Hostname#show ? |
access-list
acl-object
arl
arp
arp-security
bfd
bgp
cable-diagnostics
card_list
clock
cluster
cpu |
List access lists
Show acl object
Address translation item
Command arp
To CPU arp security
BFD Protocol information
BGP information
Cable Diagnostics on physical interface
Show information of hardware modules
Print system clock information
Config cluster
Show CPU use per process |
- Type a character string followed by "?", and all the key words starting with the character string and their description are displayed.
Hostname#show a?
|
access-list
acl-object
arl
arp
arp-security |
List access lists
Show acl object
Address translation item
Command arp
To CPU arp security |
Command Line Error Messages
For all commands that are typed by users, the command line performs a syntax check. If the commands pass the syntax check, they are executed properly; otherwise, the system reports error messages to the users. The following table shows common error messages.
Table 1-3 Command Line Error Messages
Error Message
|
Error Cause
|
% Invalid input detected at '^' marker.
|
No command or key word is found, the parameter type is incorrect, or the parameter value is not within the valid range.
|
Type “*** ?” for a list of subcommands
or
% Incomplete command
|
The inputted command is incomplete.
|
Hostname#wh
% Ambiguous command: wh
% Please select:
whoami
who
|
The inputted character string is a fuzzy command.
|
History Commands
The command line interface provides a function that is similar to the Doskey function. The system automatically saves the user inputted commands into the history command cache. Then, users can invoke the history commands saved by the command line interface at any time and execute the command repeatedly, reducing unnecessary efforts in re-typing the commands. The command line interface saves up to 10 commands for each user that is connected to the device. Then, new commands overwrite old ones.
Table 1-4 Accessing History Commands of the Command Line Interface
To...
|
Press...
|
Execution Result
|
Access the previous history command
|
The up arrow key ↑ or Ctrl+P keys
|
If an earlier history command is available, it is displayed. If no earlier history command is available, an alarm sound is played.
|
Access the next history command
|
The down arrow key ↓ or Ctrl+P keys
|
If a later history command is available, it is displayed. If no later command is available, the commands are cleared, and an alarm sound is played.
|
-
If you want to access history commands by using the up and down arrow keys, when you telnet to the device in the Windows 98 or Windows NT OS, set Terminals > Preferred Options > Simulation Options to VT-100/ANSI.
- History command display is based on the current command mode. For example, if you are in privileged mode, only history commands in privileged mode are displayed.
Editing Features
The command line interface provides basic command editing functions. It supports multi-line editing. Each line of command can contain up to 256 characters. The following table lists the basic editing functions that are provided by the shell subsystem for the command line interface.
Table 1‑5 Basic Editing Functions
Key
|
Function
|
A common key
|
If the edit buffer is not full, the character is inserted to the position of the cursor, and the cursor moves to the right. If the edit buffer is full, an alarm sound is played.
|
The Backspace key
|
Deletes the character before the cursor and moves the cursor backward. If the cursor reaches the beginning of the command, an alarm sound is played.
|
The Delete key
|
Deletes the character behind the cursor. If the cursor reaches the end of the command, an alarm sound is played.
|
The left arrow key ← or Ctrl+B keys
|
Moves the cursor one characters to the left. If the cursor reaches the beginning of the command, an alarm sound is played.
|
The right arrow key → or Ctrl+F keys
|
Moves the cursor one characters to the right. If the cursor reaches the end of the command, an alarm sound is played.
|
The up and down arrow keys ↑↓
|
Display history commands.
|
Ctrl+A
|
Moves the cursor to the beginning of the command line.
|
Ctrl+E
|
Moves the cursor to the end of the command line.
|
Ctrl+U
|
Deletes all characters on the left of the cursor till the beginning of the command line.
|
Display Features
To facilitate users, the command line interface provides the following display features:
If the information to be displayed is more than one screen, the pause function is provided, and the prompt "---MORE---" is displayed at the lower left corner of the screen. At this time, the options displayed in the following table are available for users.
Table 1‑6 Display Features
Key
|
Function
|
Space key, down arrow key ↓, or Ctrl-F
|
Display the next screen.
|
The up arrow key ↑ or Ctrl-B keys
|
Display the previous screen.
|
The Enter key, right arrow key → or equal key =
|
Scroll the displayed information one line down.
|
The left arrow key ← or the minus key -
|
Scroll the displayed information one line up.
|
Ctrl-H
|
Returns back to the topmost part of the displayed information.
|
Any other keys
|
Exits the display. Then, the information that has not been displayed will not be displayed.
|