CLI Overview: About This Chapter
CLI Overview: About This Chapter
1 CLI Overview
except the following views, see the S2720, S5700, and S6720 V200R013C00
Command Reference.
User view When a user logs in to In the user view, you can
the device, the user view the running status
enters the user view and and statistics of the
the following prompt is device.
displayed:
<HUAWEI>
The command line prompt HUAWEI is the default host name (sysname). The
prompt indicates the current view. For example, <> indicates the user view and []
indicates all other views except the user view.
You can enter ! or # followed by a character string in any view. All entered content
(including ! and #) is displayed as comments. That is, the corresponding
configuration is not generated.
● Some commands can be executed in multiple views, but they have different functions
after being executed in different views. For example, you can run the lldp enable
command in the system view to enable LLDP globally and in the interface view to
enable LLDP on an interface.
● In the system view, you can run the diagnose command to enter the diagnostic view.
Diagnostic commands are used for device fault diagnosis. If you run some commands in
the diagnostic view, the device may fail to run properly or services may be interrupted.
Contact technical support personnel and use these diagnostic commands with caution.
● You can enter ! or # followed by a character string in any view. All the entered content
(including ! and #) is displayed as comments and can be properly. That is, no error
message is displayed and no the corresponding configuration is not generated.
To return from the AAA view directly to the user view, press Ctrl+Z or run the
return command.
# Press Ctrl+Z to return directly to the user view.
[HUAWEI-aaa] // Enter Ctrl+Z
<HUAWEI>
Intelligent Rollback
Intelligent rollback enables the system to automatically return to the previous
view if a command fails to be executed in the current view. The system performs
view return attempts until the applicable view of the command is displayed. The
system can return to the system view at the maximum extent.
Intelligent rollback cannot be performed in the port group view and VLAN-Range view.
If command matching fails because an ambiguous command is entered in the current view,
no intelligent rollback can be performed.
If the intelligent rollback function is enabled, commands may be executed in unexpected
views, and services may be interrupted. Before configuring a command, check whether the
command to be configured exists in the view. If the command does not exist, run the
command in the correct view.
The following provides two application examples for intelligent rollback. The
system enters the applicable view of a command after performing one view return
attempt in the first example, and performs multiple attempts in the second
example.
1. After entering an OSPF area view, the system allows a user to directly enter
another OSPF area view, without the need to manually return to the OSPF
view.
<HUAWEI> system-view
[HUAWEI] ospf 100
[HUAWEI-ospf-100] area 1
[HUAWEI-ospf-100-area-0.0.0.1] area 2
[HUAWEI-ospf-100-area-0.0.0.2]
2. After entering an OSPF area view, the system allows a user to directly enter
an interface view, without the need to manually return to the system view.
<HUAWEI> system-view
[HUAWEI] ospf 100
[HUAWEI-ospf-100] area 1
[HUAWEI-ospf-100-area-0.0.0.1] interface gigabitEthernet 0/0/3
[HUAWEI-GigabitEthernet0/0/3]
Backspace Deletes the character on the left of the cursor and the
cursor moves to the left. When the cursor reaches the
head of the command, an alarm is generated.
Left cursor key ← or Moves the cursor to the left by the space of a
Ctrl+B character. When the cursor reaches the head of the
command, an alarm is generated.
Right cursor key → or Moves the cursor to the right by the space of a
Ctrl+F character. When the cursor reaches the end of the
command, an alarm is generated.
Operating Techniques
Incomplete Keyword
You can enter incomplete keywords on the device. In the current view, you do not
need to enter complete keywords if the entered characters can match a unique
keyword. This function improves operating efficiency.
NOTICE
Tab
Enter an incomplete keyword and press Tab to complete the keyword.
● When a unique keyword matches the input, the system replaces the
incomplete input with the unique keyword and displays it in a new line
followed by a space. For example:
a. Enter an incomplete keyword.
[HUAWEI] info-
b. Press Tab.
The system replaces the entered keyword and displays it in a new line
with the complete keyword followed by a space.
[HUAWEI] info-center
● When the input has multiple matches, press Tab repeatedly to display the
keywords beginning with the incomplete input in a circle until the desired
keyword is displayed. In this case, the cursor closely follows the end of the
keyword. For example:
a. Enter an incomplete keyword.
[HUAWEI] info-center log
b. Press Tab.
The system displays the prefixes of all the matched keywords. In this
example, the prefix is log.
[HUAWEI] info-center loghost
Press Tab to switch from one matched keyword to another. In this case,
the cursor closely follows the end of a word.
[HUAWEI] info-center logbuffer
b. Press Tab.
[HUAWEI] info-center loglog
The system displays information in a new line, but the keyword loglog
remains unchanged and there is no space between the cursor and the
keyword. This indicates that this keyword does not exist.
Full Help
When entering a command, you can use the full help function to obtain keywords
and parameters for the command. Use any of the following methods to obtain full
help from a command line.
● Enter a question mark (?) in any command view to obtain all the commands
and their simple descriptions. For example:
<HUAWEI> ?
User view commands:
backup Backup electronic elabel
cd Change current directory
check Check information
clear Clear information
clock Specify the system clock
compare Compare function
...
Partial Help
If you enter only the first or first several characters of a command keyword, partial
help provides keywords that begin with this character or character string. Use any
of the following methods to obtain partial help from a command line.
● Enter a character string followed directly by a question mark (?) to display all
keywords that begin with this character string. For example:
<HUAWEI> d?
debugging delete
dir display
<HUAWEI> d
● Enter a command and a string followed directly by a question mark (?) to
display all the keywords that begin with this string. For example:
<HUAWEI> display b?
bpdu bridge
buffer
● Enter the first several letters of a keyword in a command and press Tab to
display a complete keyword. The first several letters, however, must uniquely
identify the keyword. If they do not identify a specific keyword, press Tab
continuously to display different keywords and you can select one as required.
The command output obtained through the online help function is used for reference only.
Procedure
Step 1 In the user view, run terminal command forward matched upper-view.
Forward commands are enabled to be run in the upper-level view.
The terminal command forward matched upper-view command is valid for current login
users who run this command.
----End
Log out of the terminal and re-log in. A message "Hello, Welcome to
Huawei!" is displayed before authentication. Run the undo header login
command.
Hello,Welcome to Huawei!
Login authentication
Password:
Info: The max number of VTY users is 20, and the number
of current VTY users on line is 5.
The current login time is 2012-06-09 04:46:00.
<HUAWEI> system-view
[HUAWEI] undo header login
Log out of the terminal and re-log in. No message is displayed before
authentication.
Login authentication
Password:
Info: The max number of VTY users is 20, and the number
of current VTY users on line is 5.
The current login time is 2012-06-09 04:52:10.
<HUAWEI>
The command output provided here is used for reference only. The actual output
information may differ from the preceding information.
Procedure
Step 1 Run system-view
The system view is displayed.
----End
The terminal in use may affect the functions of the shortcut keys because the shortcut keys
entered by the user are captured by the terminal program. For example, if the shortcut keys
defined by the terminal conflict with those defined in the system, the commands
corresponding to the shortcut keys are not executed.
Key Function
Key Function
display this
This command does not display parameters that use default settings.
To view the default configurations that have not been modified in the current
view, run the display this include-default command.
habit of using the character mode. Therefore, use the character mode for
common users to improve operation efficiency.
A simple regular expression does not contain any special character. For
example, you can create a simple regular expression "hello" to match the
character string "hello" only. In practice, multiple common and special
characters are used together to match a character string with special features.
Unless otherwise specified, degeneration rules also apply when the preceding regular
expressions are subexpressions within parentheses.
NOTICE
The switch uses a regular expression to implement the pipe character filtering
function. A display command supports the pipe character only when there is
excessive output information.
There are two modes to filter output information based on the regular expression.
● Specifying a filtering mode in a command: enter the keyword begin, exclude,
or include, and a regular expression in the command line to filter command
outputs.
● Specifying a filtering mode on a split screen: enter a slash (/), minus (-), or
plus (+) symbol, and a regular expression to filter command outputs to be
displayed on a split screen. The slash (/), minus (-), and plus (+) symbols have
the same functions as the keywords begin, exclude, and include.
Specifying a Filtering Mode in a Command
Some commands can carry the parameter | count to display the number of
matching entries. The parameter | count can be used together with other
parameters.
Three filtering modes are provided for commands that support regular
expressions.
● | begin regular-expression: displays all the lines beginning with the line that
matches the regular expression.
Filter the character strings to be entered until the specified case-sensitive
character string is displayed. All the character strings following this specified
character string are displayed on the screen.
● | exclude regular-expression: displays all the lines that do not match the
regular expression.
If the character strings to be entered do not contain the specified case-
sensitive character string, they are displayed on the screen. Otherwise, they
are filtered.
● | include regular-expression: displays all the lines that match the regular
expression.
If the character strings to be entered contain the specified case-sensitive
character string, they are displayed on the screen. Otherwise, they are filtered.
You can specify the filtering mode of output information for some display commands that
have large amount of output information.
After the command output is filtered, the displayed information is displayed with
its context. Context rules are as follows:
● before before-line-number: displays lines that match filtering rules and the
preceding before-line-number lines.
● after after-line-number: displays lines that match filtering rules and the
subsequent after-line-number lines.
● before before-line-number + after after-line-number or after after-line-
number + before before-line-number: displays lines that match filtering rules,
the preceding before-line-number lines, and the subsequent after-line-number
lines.
Values of before-line-number and after-line-number are a string of 1 to 999
characters.
Example 1: Run the display interface brief command to display all the lines that
do not match Ethernet, NULL, or Tunnel.
<HUAWEI> display interface brief | exclude Ethernet|NULL|Tunnel
PHY: Physical
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(dl): DLDP down
(d): Dampening Suppressed
InUti/OutUti: input utility/output utility
Interface PHY Protocol InUti OutUti inErrors outErrors
Eth-Trunk1 down down 0% 0% 0 0
Eth-Trunk17 down down 0% 0% 0 0
LoopBack1 up up(s) 0% 0% 0 0
Vlanif1 up down -- -- 0 0
MEth0/0/1 down down 0% 0% 0 0
Vlanif2 down down -- -- 0 0
Vlanif10 down down -- -- 0 0
Vlanif12 down down -- -- 0 0
Vlanif13 down down -- -- 0 0
Vlanif20 up up -- -- 0 0
Vlanif22 down down -- -- 0 0
Vlanif222 down down -- -- 0 0
Vlanif4094 down down -- -- 0 0
The command output provided here is used for reference only. The actual output
information may differ from the preceding information.
Filtering...
interface Vlanif10
interface Vlanif100
For details about command levels, see S2720, S5700, and S6720 V200R013C00
Command Reference.
The default command level setting is appropriate for user operation rights control;
therefore, you are advised not to change command levels. If there are special
requirements on user operation rights of a specific-level user, you can change the
command level of specified commands. For example, if only level-4 and a higher
level users are allowed to execute the stelnet command, you can upgrade the
command level of the stelnet command to level-4.
In addition to upgrade a command level, you can also lower a command level.
Do not change the default level of a command. Otherwise, some users may be unable to
use the command. If command levels are changed separately before you upgrade command
levels in a batch, the levels of these commands remain unchanged. Therefore, you are
advised to upgrade command levels in a batch before you upgrade the level of each
command separately.
The execution of some commands depends on some conditions. For example, a command
can be configured only when other commands are configured or the command is an
upgrade-compatible command. When levels of these commands are adjusted using the
command-privilege level command, the adjusted commands may not be executed. Level
adjustment of a command is irrelevant to execution of the command.
Procedure
Step 1 Run system-view
----End
By default, the system saves 10 history commands for each user. Run the history-
command max-size size-value command to reset the number of history
commands that can be saved in a specified user interface view. The maximum
number is 256.
Display the later Down arrow key ↓ or Ctrl+N A later history command
history command. is displayed. If the
current command is the
latest command, no
output is displayed and
an alarm is generated
when you attempt to
display the later history
command.
You cannot access history commands using the Up arrow key ↑ in HyperTerminal Windows
9X. The Up arrow key ↑ has a different function in HyperTerminal Windows 9X and needs to
be replaced by the shortcut key Ctrl+P.