Title | Size | Download |
---|---|---|
01-CLI Commands | 108.44 KB |
Contents
command-alias enable
Syntax
command-alias enable
undo command-alias enable
View
System view
Default level
2: System level
Parameters
None
Description
Use the command-alias enable command to enable the command keyword alias function.
Use the undo command-alias enable command to disable the command keyword alias function.
By default, the command keyword alias function is disabled.
Examples
# Enable the command keyword alias function.
<Sysname> system-view
[Sysname] command-alias enable
# Disable the command keyword alias function.
<Sysname> system-view
[Sysname] undo command-alias enable
command-alias mapping
Syntax
command-alias mapping cmdkey alias
undo command-alias mapping cmdkey
View
System view
Default level
2: System level
Parameters
cmdkey: Complete form of the first keyword of a command.
alias: Specifies the command keyword alias, which must be different from the first keyword of any existing command.
Description
Use the command-alias mapping command to configure a command keyword alias.
Use the undo command-alias mapping command to delete a command keyword alias.
By default, a command keyword has no alias.
Examples
# Configure show as the alias of the display keyword.
<Sysname> system-view
[Sysname] command-alias mapping display show
After you configure the alias, you can enter show instead of display to execute a display command. For example, you can enter show clock to execute the display clock command to view the system time and date.
# Delete the alias of the display keyword.
<Sysname> system-view
[Sysname] undo command-alias mapping display
command-privilege
Syntax
command-privilege level level view view command
undo command-privilege view view command
View
System view
Default level
3: Manage level
Parameters
level level: Command level, which ranges from 0 to 3.
view view: Specifies a view. The value shell represents a user view. The view argument must be the view where the command resides.
command: Command to be set in the specified view.
Description
Use the command-privilege command to assign a level for the specified command in the specified view.
Use the undo command-privilege command to restore the default.
By default, each command in a view has its specified level. For more information, see Fundamentals Configuration Guide.
Command levels include four privileges: visit (0), monitor (1), system (2), and manage (3). You can assign a privilege level according to the user’s need. When logging in to the router, the user can access at the specified level and all lower levels.
H3C recommends you to use the default command level or modify the command level under the guidance of professional staff. An improper command level change may bring inconvenience to your maintenance and operation, or even potential security problems.
The command specified in the command-privilege command must be complete, and has valid arguments. For example, the default level of the tftp server-address { get | put | sget } source-filename [ destination-filename ] [ source { interface interface-type interface-number | ip source-ip-address } ] command is 3. After the command-privilege level 0 view shell tftp 1.1.1.1 put a.cfg command is executed, when users with the user privilege level of 0 log in to the router, they can execute the tftp server-address put source-filename command (such as the tftp 192.168.1.26 put syslog.txt command), but cannot execute the command with the get, sget or source keyword, and cannot specify the destination-filename argument.
The command specified in the undo command-privilege view command can be incomplete. For example, after the undo command-privilege view system ftp command is executed, all commands starting with the keyword ftp (such as ftp server acl, ftp server enable, and ftp timeout) are restored to their default level. If you have modified the level of commands ftp server enable and ftp timeout, and you want to restore only the ftp server enable command to its default level, you should use the undo command-privilege view system ftp server command.
If you modify the command level of a command in a specified view from the default command level to a lower level, remember to modify the command levels of the quit command and the corresponding command that is used to enter this view. For example, the default command level of commands interface and system-view is 2 (system level); if you want to make the interface command available to the users with the user privilege level of 1, you need to execute the following three commands: command-privilege level 1 view shell system-view, command-privilege level 1 view system interface GigabitEthernet 3/0/1, and command-privilege level 1 view system quit, so that the login users with the user privilege level of 1 can enter system view, execute the interface ethernet command, and then return to user view.
Examples
# Set the command level of the system-view command to 3 in system view.
[Sysname] command-privilege level 3 view shell system-view
display clipboard
Syntax
display clipboard [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display clipboard command to view the contents of the clipboard.
To copy the specified content to the clipboard:
· Move the cursor to the starting position of the content and press the <Esc+Shift+,> combination.
· Move the cursor to the ending position of the content and press the <Esc+Shift+.> combination.
Examples
# View the content of the clipboard.
<Sysname> display clipboard
---------------- CLIPBOARD-----------------
display current-configuration
display command-alias
Syntax
display command-alias [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display command-alias command to display defined command keyword aliases and the corresponding keywords.
Examples
# Display the defined command keyword aliases and the corresponding keywords.
<Sysname> display command-alias
Command alias is enabled
index alias command key
1 show display
display history-command
Syntax
display history-command [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display history-command command to display commands saved in the history command buffer.
The system saves up to 10 latest executed commands in the history command buffer by default. To set the size of the history command buffer, use the history-command max-size command. For more information, see the chapter “Login management commands.”
Examples
# Display history commands in current user view.
<Sysname> display history-command
display history-command
system-view
vlan 2
quit
display hotkey
Syntax
display hotkey [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display hotkey command to display hotkey information.
Examples
# Display hotkey information.
<Sysname> display hotkey
----------------- HOTKEY -----------------
=Defined hotkeys=
Hotkeys Command
CTRL_G display current-configuration
CTRL_L display ip routing-table
CTRL_O undo debug all
=Undefined hotkeys=
Hotkeys Command
CTRL_T NULL
CTRL_U NULL
=System hotkeys=
Hotkeys Function
CTRL_A Move the cursor to the beginning of the current line.
CTRL_B Move the cursor one character left.
CTRL_C Stop current command function.
CTRL_D Erase current character.
CTRL_E Move the cursor to the end of the current line.
CTRL_F Move the cursor one character right.
CTRL_H Erase the character left of the cursor.
CTRL_K Kill outgoing connection.
CTRL_N Display the next command from the history buffer.
CTRL_P Display the previous command from the history buffer.
CTRL_R Redisplay the current line.
CTRL_V Paste text from the clipboard.
CTRL_W Delete the word left of the cursor.
CTRL_X Delete all characters up to the cursor.
CTRL_Y Delete all characters after the cursor.
CTRL_Z Return to the User View.
CTRL_] Kill incoming connection or redirect connection.
ESC_B Move the cursor one word back.
ESC_D Delete remainder of word.
ESC_F Move the cursor forward one word.
ESC_N Move the cursor down a line.
ESC_P Move the cursor up a line.
ESC_< Specify the beginning of clipboard.
ESC_> Specify the end of clipboard.
hotkey
Syntax
hotkey { CTRL_G | CTRL_L | CTRL_O | CTRL_T | CTRL_U } command
undo hotkey { CTRL_G | CTRL_L | CTRL_O | CTRL_T | CTRL_U }
View
System view
Default level
2: System level
Parameters
CTRL_G: Associates hot key Ctrl+G to the specified command.
CTRL_L: Associates hot key Ctrl+L to the specified command.
CTRL_O: Associates hot key Ctrl+O to the specified command.
CTRL_T: Associates hot key Ctrl+T to the specified command.
CTRL_U: Associates hot key Ctrl+U to the specified command.
command: Command line associated with the hot key.
Description
Use the hotkey command to associate a hot key to a command.
Use the undo hotkey command to restore the default.
By default, Ctrl+G, Ctrl+L and Ctrl+O are associated to corresponding commands, but others are not.
· Ctrl+G corresponds to display current-configuration.
· Ctrl+L corresponds to display ip routing-table.
· Ctrl+O corresponds to undo debugging all.
You can modify the associations as needed.
Examples
# Associate the hot key Ctrl+T to the display tcp status command.
<Sysname> system-view
[Sysname] hotkey ctrl_t display tcp status
# Display the configuration of hotkeys.
[Sysname] display hotkey
----------------- HOTKEY -----------------
=Defined hotkeys=
Hotkeys Command
CTRL_G display current-configuration
CTRL_L display ip routing-table
CTRL_O undo debug all
CTRL_T display tcp status
=Undefined hotkeys=
Hotkeys Command
CTRL_U NULL
=System hotkeys=
Hotkeys Function
CTRL_A Move the cursor to the beginning of the current line.
CTRL_B Move the cursor one character left.
CTRL_C Stop current command function.
CTRL_D Erase current character.
CTRL_E Move the cursor to the end of the current line.
CTRL_F Move the cursor one character right.
CTRL_H Erase the character left of the cursor.
CTRL_K Kill outgoing connection.
CTRL_N Display the next command from the history buffer.
CTRL_P Display the previous command from the history buffer.
CTRL_R Redisplay the current line.
CTRL_V Paste text from the clipboard.
CTRL_W Delete the word left of the cursor.
CTRL_X Delete all characters up to the cursor.
CTRL_Y Delete all characters after the cursor.
CTRL_Z Return to the user view.
CTRL_] Kill incoming connection or redirect connection.
ESC_B Move the cursor one word back.
ESC_D Delete remainder of word.
ESC_F Move the cursor forward one word.
ESC_N Move the cursor down a line.
ESC_P Move the cursor up a line.
ESC_< Specify the beginning of clipboard.
ESC_> Specify the end of clipboard.
quit
Syntax
quit
View
Any view
Default level
0: Visit level (in user view)
2: System level (in other views)
Parameters
None
Description
Use the quit command to return to a lower-level view. If the current view is user view, the quit command terminates the current connection and exits the system.
Examples
# Switch from GigabitEthernet 3/1/1 interface view to system view, and then to user view.
[Sysname-GigabitEthernet3/1/1] quit
[Sysname] quit
<Sysname>
return
Syntax
return
View
Any view except user view
Default level
2: System level
Parameters
None
Description
Use the return command to return to user view from any other view in one operation, instead of using the quit command repeatedly. Pressing Ctrl+Z has the same effect.
Related commands: quit.
Examples
# Return to user view from GigabitEthernet 3/1/1 interface view.
[Sysname-GigabitEthernet3/1/1] return
<Sysname>
screen-length disable
Syntax
screen-length disable
undo screen-length disable
View
User view
Default level
1: Monitor level
Parameters
None
Description
Use the screen-length disable command to disable pausing between screens of output for the current session.
Use the undo screen-length disable command to enable pausing between screens of output for the current session.
By default, a login user uses the settings of the screen-length command. The default settings of the screen-length command are: pausing between screens of output is enabled and 24 lines are displayed on a screen.
This command is applicable to the current session only. When a user re-logs in, the settings restore to their default values.
Related commands: screen-length.
Examples
# Disable pausing between screens of output for the current session.
<Sysname> screen-length disable
super
Syntax
super [ level ]
View
User view
Default level
0: Visit level
Parameters
level: User level, which ranges from 0 to 3 and defaults to 3.
Description
Use the super command to switch from the current user privilege level to a specified user privilege level.
Without a level specified, the command switches the current user privilege level to 3.
Login users are classified into four levels that correspond to the four command levels. After users at different levels log in, they can only use commands at their own level, or lower levels.
A user can switch to a lower privilege level unconditionally. A logged-in AUX or VTY user must enter the switching password set with the super password command to switch to a higher privilege level. If the entered password is incorrect or no password is configured, the switching operation fails. Therefore, before switching to a higher user privilege level, you must configure the switching password.
Related commands: super password and super authentication-mode.
Examples
# Switch to user privilege level 2 (The current user privilege level is 3.).
<Sysname> super 2
User privilege level is 2, and only those commands can be used
whose level is equal or less than this.
Privilege note: 0-VISIT, 1-MONITOR, 2-SYSTEM, 3-MANAGE
# Switch the user privilege level back to 3 (switching password 123 has been set. If no password is set, the user privilege level cannot be switched to 3.).
<Sysname> super 3
Password:
User privilege level is 3, and only those commands can be used
whose level is equal or less than this.
Privilege note: 0-VISIT, 1-MONITOR, 2-SYSTEM, 3-MANAGE
super authentication-mode
Syntax
super authentication-mode { local | scheme } *
undo super authentication-mode
View
System view
Default level
2: System level
Parameters
local: Authenticates a user by using the local password set with the super password command. In this case, when no password is set with the super password command, privilege level switching succeeds if the user is logged in from the console port (here indicates the console port or the AUX port used as the console port), and the switch fails if the user is logged in from any of the AUX, TTY, or VTY user interfaces or enters an incorrect switch password.
scheme: AAA authentication. For more information about AAA, see Security Configuration Guide.
local scheme: First local and then scheme, which means to authenticate a user by using the local password first, and if no password is set, for the user logged in from the console port, the privilege level switching succeeds; for the user logged in from any of the AUX, TTY, or VTY user interfaces, the AAA authentication is performed.
scheme local: First scheme and then local, which means that AAA authentication is performed first, and if the AAA configuration is invalid (domain parameters or authentication scheme are not configured) or the server does not respond, the authentication requiring the local password is performed.
Description
Use the super authentication-mode command to set the authentication mode for user privilege level switching.
Use the undo super authentication-mode command to restore the default.
By default, the authentication mode for user privilege level switching is local.
Related commands: super password.
Examples
# Set the authentication mode for user privilege level switching to local.
<Sysname> system-view
[Sysname] super authentication-mode local
# Set the authentication mode for user privilege level switching to scheme local.
<Sysname> system-view
[Sysname] super authentication-mode scheme local
super password
Syntax
super password [ level user-level ] { simple | cipher } password
undo super password [ level user-level ]
View
System view
Default level
2: System level
Parameters
level user-level: User privilege level, which ranges from 1 to 3 and defaults to 3.
simple: Plain text password.
cipher: Cipher text password.
password: Password, a case-sensitive string of characters.
· A simple password is a string of 1 to 16 characters.
· A cipher password is a string of 1 to 16 characters in plain text or 24 characters in cipher text. For example, the simple text “1234567” corresponds to the cipher text “(TT8F]Y\5SQ=^Q`MAF4<1!!”.
Description
Use the super password command to set the password used to switch from the current user privilege level to a higher one.
Use the undo super password command to restore the default.
By default, no password is set for switching to a higher privilege level.
Use the simple keyword to set a simple-text password.
Use the cipher keyword to set a cipher-text password.
A cipher-text password is recommended because a simple-text password easily gets cracked.
During authentication, you must enter a simple-text password regardless of the password type you set.
Examples
# Set simple-text password abc for switching to user privilege level 3.
<Sysname> system-view
[Sysname] super password level 3 simple abc
# Display the configured password for level switching.
[Sysname] display current-configuration
#
super password level 3 simple abc
# Set cipher-text password abc for switching to user privilege level 3.
<Sysname> system-view
[Sysname] super password level 3 cipher abc
# Display the configured password for level switching.
[Sysname] display current-configuration | include super
#
super password level 3 cipher ;)<01%^&;YGQ=^Q`MAF4<1!!
system-view
Syntax
system-view
View
User view
Default level
2: System level
Parameters
None
Description
Use the system-view command to enter system view from the current user view.
Related commands: quit, return.
Examples
# Enter system view from the current user view.
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname]