AR100, AR120, AR150, AR160, AR200, AR1200, AR2200, AR3200, and AR3600 V200R010 Command Reference
CLI Overview Commands
assistant task
Function
The assistant task command creates an assistant task.
The undo assistant task command deletes an assistant task.
By default, no assistant task is created.
Parameters
Parameter | Description | Value |
---|---|---|
task-name | Specifies the name of an assistant task. |
The value is a string of 1 to 15 characters. It can consist of underscores (_), letters, and digits only, and must start with a letter. |
Usage Guidelines
An assistant task is a virtual assistant on the device to realize automatic maintenance and management. After you create an assistant task and bind it to a batch of files to be processed, the device performs operations or configurations when it is unattended. Assistant tasks are mainly used for scheduled system upgrade or configuration.
You can create a maximum of five assistant tasks on the device.
command-privilege level
Function
The command-privilege level command sets the command level in a specified view.
The undo command-privilege command restores the default command level.
By default, each command in each view has a default command level.
Format
command-privilege level level view view-name command-key
undo command-privilege view view-name command-key
Parameters
Parameter | Description | Value |
---|---|---|
level level | Specifies the command level. | The value is an integer that ranges from 0 to 15. |
view view-name | Specifies the view name. You can enter a question mark (?) in the terminal GUI to obtain all view names in the command view. |
- |
command-key | Specifies a command. The command must be entered manually because automatic command line completion is not supported. |
- |
Usage Guidelines
Usage Scenario
The system divides commands into four levels and sets the command level in the specified view. The device administrator can change the command level as required, so that a lower-level user can use some high-level commands. The device administrator can also change the command level to a larger value to improve device security.
Precautions
You are not advised to change the default command level. If you need to change it, consult with professional personnel to ensure that routine operation and maintenance are not affected and security risk is avoided.
The rules for using this command to set the command level of a specified view are as follows:
- When you degrade the target command, all keywords in the command are degraded.
- When you upgrade the target command, only the last keyword in the command is upgraded.
- When you set a level for the target command, the levels of all commands (in the same view) starting with this command are changed.
- When you set a level for the target command, the keyword level in other commands having the same index as the keyword whose level is changed is also changed.
- If the level of keywords that have the same index is modified for multiple times, the latest configured level takes effect.
- This command is not supported in a dual-SRU scenario.
diagnose
display assistant task history
Function
The display assistant task history command displays operation records of an assistant task.
Parameters
Parameter | Description | Value |
---|---|---|
task-name | Specifies the name of an existing assistant task. |
The value is a string of 1 to 15 characters consisting only of underscores (_), letters, and digits, and must start with a letter. |
Usage Guidelines
The latest five operations of each assistant task are displayed in an earlier-to-later order.
Example
# Displays operation records of an assistant task.
<Huawei> display assistant task history
-------------------------------------------------------------------------------- Assistant task name: nemo -------------------------------------------------------------------------------- Assistant task name: song Action type : Batch file Batch file name: sd1:/reboottest.bat Start time : 2012-07-16 09:25:00 End time : 2012-07-16 09:25:00 State : Finished Action type : Batch file Batch file name: sd1:/reboottest.bat Start time : 2012-07-16 09:24:00 End time : 2012-07-16 09:24:00 State : Finished -------------------------------------------------------------------------------- Assistant task name: xu Action type : Batch file Batch file name: sd1:/reboottest.bat Start time : 2012-07-16 09:25:00 End time : 2012-07-16 09:25:00 State : Finished Action type : Batch file Batch file name: sd1:/reboottest.bat Start time : 2012-07-16 09:24:00 End time : 2012-07-16 09:24:00 State : Finished Action type : Batch file Batch file name: sd1:/reboottest.bat Start time : 2012-07-16 09:23:00 End time : 2012-07-16 09:23:00 State : Finished --------------------------------------------------------------------------------
Item |
Description |
---|---|
Assistant task name |
Task name. This parameter is configured using the assistant task command. |
Action type |
Operation that an assistant task performs. |
Batch file name |
Name of the batch file used by an assistant task. This parameter is configured using the perform batch-file command. |
Start time |
Operation start time of an assistant task. |
End time |
Operation end time of an assistant task. |
State |
Running status of an assistant task.
|
display command-view
Parameters
Parameter | Description | Value |
---|---|---|
command-key | Specifies the command word of the command to be queried. Currently, the command word cannot be automatically displayed through the question mark help function, and needs to be entered manually. |
The value is a string of 1 to 200 case-insensitive characters that can include spaces. |
Usage Guidelines
You can run this command to check the view of a specified command. For example, if you need to run the command-privilege level command to change the level of a specified command, run the display command-view command to check the view of the specified command.
display history-command
Function
The display history-command command displays the historical commands stored on the current device.
Usage Guidelines
Usage Scenario
You can run this command to check historical commands the user has executed recently. This command facilitates information search. Historical commands are stored in the circular mode and a maximum of 200 historical commands can be displayed.
Precautions
All the historical commands entered by a user are automatically saved on the terminal, that is, any input that ends with Enter is saved as a historical command.
Historical commands are saved in the same format as that used in the input. If a command that is entered by a user is in an incomplete format, the saved historical command is also in the incomplete format.
If a user runs a command several times, only the latest command is saved on the device. If the command is entered in different formats, they are considered as different commands.
You can view historical commands using the following methods:
To view the previous historical command, press the Up arrow key or Ctrl+P.
If there is an earlier historical command, the earlier historical command is displayed.
To view the next historical command, press the Down arrow key or Ctrl+N.
If there is a new historical command, the new historical command is displayed.
display hotkey
Function
The display hotkey command displays the status of the defined, undefined, and system hotkeys.
Usage Guidelines
After you understand the defined, undefined, and system hotkeys in the system, you can use hotkeys to quickly enter commands. To redefine hotkeys for a command, run the hotkey command.
The system allows hotkeys in places where commands can be entered, and displays the commands corresponding to hotkeys. You can run the display hotkey command to view the commands corresponding to hotkeys.
Example
# Display defined, undefined, and system hotkeys.
<Huawei> display hotkey
----------------- HOTKEY ----------------- =Defined hotkeys= Hotkeys Command CTRL_G display current-configuration CTRL_L undo idle-timeout CTRL_O undo debugging all =Undefined hotkeys= Hotkeys Command CTRL_U NULL =System hotkeys= Hotkeys Function CTRL_A Move the cursor to the beginning of the first 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 Last line CTRL_F Move the cursor one character right CTRL_H Erase the character left of the cursor CTRL_K Kill outgoing connection when connecting CTRL_N Display the next command from the history buffer CTRL_P Display the previous command from the history buffer CTRL_T Function as a question mark 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
display this
Usage Guidelines
Usage Scenario
After the configurations are complete in a certain view, run the display this command to check the current configurations.
Precautions
If a configuration parameter uses the default value, this parameter is not displayed. The set parameters that do not be committed successfully are neither displayed.
If you run the display this command in an interface view, configuration of the interface view is displayed. If you run this command in a protocol view, configuration of the protocol view is displayed.
header
Function
The header command configures the header information displayed on a terminal when users log in to a connected device.
The undo header command deletes the header information displayed on a terminal when users log in to a connected device.
By default, no header information is displayed on terminals when users log in to a connected device.
Parameters
Parameter | Description | Value |
---|---|---|
login | Indicates header information displayed on a terminal when a user logs in to the device and a connection between the terminal and the device is activated. | - |
shell | Indicates the header displayed on a terminal when the session is set up after the user logs in to the connected device. | - |
information text | Specifies the header and content. | The value is a string with spaces and carriage returns supported. The maximum length of the string that can be entered at one time is 220 characters, if a linefeed is contained in the first line. If no linefeed is contained in the first line, a maximum of 480 characters can be entered at one time, and the total string length ranges from 1 to 2000 characters. |
file file-name | Specifies the file name that the header uses. |
The value is a string of 5 to 64 characters. The maximum header file size is 128 KB. If the file size is greater than 128 KB, only the first 128 KB file information can be displayed. |
Usage Guidelines
Usage Scenario
To provide some prompts or alarms to users, you can use the header command to configure a title on the device. If a user logs in to the device, the title is displayed.
Procedure
If information is specified, the header text starts and ends with the same character. You can set the header text in either of the following modes:
Non-interactive: enter the header text behind the start character.
Use the same character at the beginning and end of the header and press Enter. If the start and end characters are inconsistent, the system prompts an error message.
Interactive: enter the start character and press Enter.
The system displays a message prompting the correct header information. Then enter the required information and enter the same character at the beginning and end of the header, and press Enter. The system quits the interactive process.
During interaction, you can press Enter at any time to enter information in the next line.
Precautions
- Before setting the login parameter, you must set login authentication parameters; otherwise, no header information about authentication is displayed.
- Before setting the file parameter, ensure that the file containing the header exists; otherwise, the file name cannot be obtained.
- If the file parameter is set, save the file containing the header in the root directory of the default storage media. To save the file to another directory, you must use a full path.
- If you use SSH1.X to log in to the device, the shell header rather than the login header is displayed.
- If you use SSH2.0 to log in to the device, both login and shell headers are displayed in the login process.
- If the header command is configured several times, only the latest configuration takes effect.
- After the login title is configured, any user that logs in to the system can view the title.
- The start and end characters in the header text can be double quotation marks (""). However, the header text content cannot contain double quotation marks ("").
Example
# Configure a shell header. (non-interactive process)
<Huawei> system-view
[Huawei] header shell information &Hello! Welcome to system!& # Enter the header text behind the start character '&' and enter '&' at the end of the header text, and press Enter.
# Display the shell header if the login succeeds.
Hello! Welcome to system!
# Configure a shell header (interactive process).
<Huawei> system-view
[Huawei] header shell information % # Press Enter after entering the start character '%' to start the interactive process.
Info: Input banner text, and quit with the character '%'. Hello! Welcome to system!%
[Huawei] quit
<Huawei> quit // Log off.
# Press Enter. The shell header is displayed when the user logs in again.
Hello!
Welcome to system!
<Huawei>
# Specify the file that stores a login header.
<Huawei> system-view [Huawei] header login file sd1:/header-file.txt
hotkey
Function
The hotkey command sets a shortcut key for a command.
The undo hotkey restores the system shortcut keys to the default values.
By default, the system sets the default values for three shortcut keys CTRL+G, CTRL+L, and CTRL+O, while does not set default value for CTRL+U.
Format
hotkey { CTRL_G | CTRL_L | CTRL_O | CTRL_U } command-text
undo hotkey { CTRL_G | CTRL_L | CTRL_O | CTRL_U }
Parameters
Parameter | Description | Value |
---|---|---|
CTRL_G | Specifies the shortcut key Ctrl+G for a command. | - |
CTRL_L | Specifies the shortcut key Ctrl+L for a command. | - |
CTRL_O | Specifies the shortcut key Ctrl+O for a command. | - |
CTRL_U | Specifies the shortcut key Ctrl+U for a command. | - |
command-text | Specifies the associated command line for shortcut keys. | The value is a string of 1 to 240 characters. |
Usage Guidelines
Usage Scenario
You can set a shortcut key for a command that is often used; you can also change the default value of the shortcut key that is defined by the system according to your requirements.
Precautions
Four shortcut keys are customized by users: CTRL+G, CTRL+L, CTRL+O, and CTRL+U.
By default, the shortcut key CTRL+G corresponds to the display current-configuration command which displays current configuration.
By default, the shortcut key CTRL+L corresponds to the undo idle-timeout command which restores the default timeout period.
By default, the shortcut key CTRL+O corresponds to the undo debugging all command which stops the output of all debugging information.
After you use the hotkey command to set a shortcut key for a command, you can run the command by pressing the shortcut key or entering a command.
One shortcut key can be set for only one command. If you set a shortcut key for multiple commands, only the latest configuration takes effect.
When assigning a command for a shortcut key, you need to mark the command with double quotation marks if the command consists of several words, that is, the command includes spaces. You do not need to mark the command with double quotation marks if the command consists of only one word.
Example
# Assign the display tcp status command for the shortcut key CTRL+L.
<Huawei> system-view
[Huawei] hotkey ctrl_l "display tcp status"
[Huawei] commit
[Huawei] display hotkey
----------------- HOTKEY ----------------- =Defined hotkeys= Hotkeys Command CTRL_G display current-configuration CTRL_L display tcp status CTRL_O undo debugging all =Undefined hotkeys= Hotkeys Command CTRL_U NULL =System hotkeys= Hotkeys Function CTRL_A Move the cursor to the beginning of the first 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 Last line CTRL_F Move the cursor one character right CTRL_H Erase the character left of the cursor CTRL_K Kill outgoing connection when connecting CTRL_N Display the next command from the history buffer CTRL_P Display the previous command from the history buffer CTRL_T Function as a question mark 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
if-match timer cron
Function
The if-match timer cron command sets the time to perform an assistant task.
The undo if-match timer cron command cancels the time configured for an assistant task.
By default, the time to perform an assistant task is not specified.
Format
if-match timer cron seconds minutes hours days-of-month months days-of-week [ years ]
undo if-match timer cron
Parameters
Parameter | Description | Value |
---|---|---|
seconds | Sets second. |
The value is a string of characters in the cron format. A cron time string consists of digits (0 to 9) and special characters asterisk (*), hyphen (-), slash (/), and comma (,). The value ranges from 1 to 127. Currently, the device supports asterisk (*) only, indicating that the value is accurate to minute but not second. |
minutes | Sets minute. |
The value is a string of characters in the cron format. A cron time string consists of digits (0 to 9) and special characters asterisk (*), hyphen (-), slash (/), and comma (,). The value ranges from 1 to 127. |
hours | Sets hour |
The value is a string of characters in the cron format. A cron time string consists of digits (0 to 9) and special characters asterisk (*), hyphen (-), slash (/), and comma (,). The value ranges from 1 to 127. |
days-of-month | Sets date. |
The value is a string of characters in the cron format. A cron time string consists of digits (0 to 9) and special characters asterisk (*), hyphen (-), slash (/), and comma (,). The value ranges from 1 to 127. This parameter is exclusive with the days-of-week parameter. At least one of the two contains asterisk (*). |
months | Sets month. |
The value is a string of characters in the cron format. A cron time string consists of digits (0 to 9) and special characters asterisk (*), hyphen (-), slash (/), and comma (,). The value ranges from 1 to 127. |
days-of-week | Sets week. |
The value is a string of characters in the cron format. A cron time string consists of digits (0 to 9) and special characters asterisk (*), hyphen (-), slash (/), and comma (,). The value ranges from 1 to 127. The parameter is exclusive with the days-of-month parameter. At least one of the two contains asterisk (*). |
years | Sets year. |
The value is a string of characters in the cron format. A cron time string consists of digits (0 to 9) and special characters asterisk (*), hyphen (-), slash (/), and comma (,). The value ranges from 1 to 127. If this parameter is not specified, it refers to all the years between 2000 to 2099. |
Usage Guidelines
Usage Scenario
The if-match timer cron command is used to set the time to perform an assistant task. The time is expressed in the cron format defined in UNIX or Linux.
- Valid characters include digits 0 to 9, and special characters asterisk (*), hyphen (-), slash (/), and comma (,).
- This table shows the syntax of cron format:
Expression Mode Format Description Example Single time point <time> <time>: The value is an integer that specifies a specific time value.
The value range is dependent on specific parameter. The range of minutes is 0 to 59. The range of hours is 0 to 23. The range of days-of-month depends on the number of days in a specific month. The range of months is 1 to 12. The range of days-of-week is 0 to 7. The range of years is 2000 to 2099.
Command: if-match timer cron * 0 1 2 5 * 2012
Meaning: perform an assistant task at 1:00 on May 2, 2012.
Multiple time points <time1>,<time2>,...,<timen> <timen>: The value is an integer. The value range depends on specific parameter.
Multiple time points are separated by a comma (,) with no space before or behind it. The time values in a list can be arranged at any sequence.
Command: if-match timer cron * 0 1,2,3 2 3 * 2012
Meaning: perform an assistant task at the following time points:- 1:00, March 2, 2012
- 2:00, March 2, 2012
- 3:00, March 2, 2012
Specific time point <time>/<step> <time>: The value is an integer that specifies a specific time value.
<step>: The value is an integer that specifies the time incremental.
The two values are separated by a slash (/) with no space before or behind it.
The format: <time>,<time>+<step>,<time>+2*<step>,...,<time>+n*<step>. The maximum time (<time>+n*<step>) depends on specific parameter in the command line.
Command: if-match timer cron * 0 0/10 * 3 * 2012
Meaning: perform an assistant task at the following time points:- 0:00, March 1, 2012
- 10:00, March 1, 2012
- 20:00, March 1, 2012
- 0:00, March 2, 2012
- ...
- 10:00, March 2, 2012
- 20:00, March 2, 2012
Duration <time1>-<time2> <time1> and <time2>: The values are integers, specifying the start and end time respectively. <time2> must be later than or equal to <time1>.
The two values are separated by a hyphen (—) with no space before or behind it.
the <time1>-<time2> is same with <time1>,<time1>+1,<time1>+2,……,<time2>. If <time1> and <time2> are the same, the two specify the same time point.
Command: if-match timer cron *0 0-3 1 3 * 2012
Meaning: perform an assistant task at the following time points:- 0:00, March 1, 2012
- 1:00, March 1, 2012
- 2:00, March 1, 2012
- 3:00, March 1, 2012
Period * If the parameter in the command line is set to *, the parameter may refer to any time point.
By setting the parameter to *, you can configure the system to periodically perform an assistant task every year, week, month, day, hour, or minute.
Command: if-match timer cron * 30 10 * 1 1 2012
Meaning: perform an assistant task at 10:30, Monday every week in January, 2012.
Combination Combination format All the expression modes can be combined except "period". The expression modes are separated by a comma (,) with no space before or behind it. Command: if-match timer cron * 0 0/10,2,4-5 1 3 * 2012
Meaning: perform an assistant task at the following time points:- 0:00, March 1, 2012
- 2:00, March 1, 2012
- 4:00, March 1, 2012
- 5:00, March 1, 2012
- 10:00, March 1, 2012
- 20:00, March 1, 2012
Precautions
If you run this command multiple times in the same view, only the latest configuration takes effect.
The days-of-month and days-of-week parameters are exclusive. Set one or both of them to "*". If one parameter is set to *, the other one specifies a specific date. If both parameters are set to *, they can refer to any date.
The minimum unit supported is second, so set the second parameter to *. The specified assistant task can work only once every minute.
Since the system can perform only one assistant task at a time, the time when one assistant task finished working may be later than the time when the next task is schedule to start. There may be a time span between the time when an assistant task is scheduled to work and the time when it actually starts to work. The if-match timer cron command specifies the time when an assistant task is scheduled to work.
When you enter digits, such as 000002012, the numeric string means the same as 2012.
Example
# Configure an assistant task to work at 20:00, 2012-05-04.
<Huawei> system-view
[Huawei] assistant task test
[Huawei-assistant-task-test] if-match timer cron * 0 20 4 5 * 2012
[Huawei-assistant-task-test] perform 1 batch-file sys.bat
# Cancel the time for an assistant task to start to work.
<Huawei> system-view
[Huawei] assistant task test
[Huawei-assistant-task-test] undo if-match timer cron
perform batch-file
Function
The perform batch-file command configures an assistant task to process a batch file.
The undo perform command disables the assistant task from processing a batch file.
By default, no batch file is configured for the assistant task.
Parameters
Parameter | Description | Value |
---|---|---|
priority | Specifies the priority of an assistant task. |
It has a fixed value of 1 at current because one assistant task can process only one batch file. |
filename | Specifies the name of the batch file processed by the assistant task. The file name is in the *.bat format. |
The value is a string of 5 to 64 case-insensitive characters without spaces. |
Usage Guidelines
Usage Scenario
After you successfully create an assistant task and specify the execution time, you can run this command to configure the device to process a batch file at the specified time.
Prerequisites
An assistant task has been created using the assistant task command and the time at which the task is executed has been specified using the if-match timer cron command.
Precautions
If an assistant task is being executed, stop the assistant task before you can delete it. If an assistant task is to be executed, directly delete it. The device will not execute the assistant task later.
By default, the commands listed in the batch file are executed in the system view.
Example
# Configure the assistant task huawei to process the batch file sys.bat at 2012-05-04 20:00.
<Huawei> system-view
[Huawei] assistant task huawei
[Huawei-assistant-task-huawei] if-match timer cron * 0 20 4 5 * 2012
[Huawei-assistant-task-huawei] perform 1 batch-file sys.bat
# Disable the assistant task to process the batch file.
<Huawei> system-view
[Huawei] assistant task huawei
[Huawei-assistant-task-huawei] undo perform 1
Info: Start to delete the action.
[Huawei-assistant-task-huawei] display this
# assistant task huawei if-match timer cron * 0 20 4 5 * 2012 # return
quit
Function
The quit command returns from the current view to a lower-level view. If the current view is the user view, this command exits from the system.
Usage Guidelines
Usage Scenario
Three types of views are available and they are listed as follows from a lower level to a higher level:
User view
System view
Service view, such as interface view
Run the quit command to return to a lower-level command view from the current view. If you are in the user view currently, after you run the quit command, you quit from the system.
return
Usage Guidelines
In other views, you can use the return command to return to the user view.
- Run this command to return to the user view if the current view is another view except the user view.
- If the current view is the user view, no change occurs after running this command.
- The shortcut keys<Ctrl+Z> have the same function as the return command.
set current-configuration display
Function
The set current-configuration display command sets the configurations that the user of a specified level can view.
The undo set current-configuration display command cancels the configuration.
By default, no configuration is specified for users.
Format
set current-configuration display [ all ] level level command-key
undo set current-configuration display [ all ] level level command-key
Parameters
Parameter | Description | Value |
---|---|---|
all | Indicates that all configuration sub-items are displayed if the configuration contains sub-items. |
- |
level level | Specifies the user level. |
The value is an integer ranging from 0 to 15. |
command-key | Specifies the command of which the output will be displayed. |
The value is a string of 1 to 255 case-sensitive characters. |
Usage Guidelines
Use Scenario
After the administrator runs the command-privilege level command to degrade the level of display current-configuration, low-level users can run the display current-configuration command to view all device configurations.
To allow the low-level users to view the specified configurations, the administrator can run the set current-configuration display command to specify the configurations to be displayed.
Precaution
If you enter a part of a command in the command-key parameter, the system matches the commands starting with the characters you entered.
If the command specified in command-key is executed in a sub-view, the display current-configuration command displays the configurations in the parent view.
To view all configuration sub-items in a configuration item, use the all keyword.
If you run the set current-configuration display command multiple times, multiple configurations can be specified. You can specify 128 configurations for the user of the certain level.
Example
<Huawei> system-view
[Huawei] command-privilege level 0 view cli_8f display current-configuration
[Huawei] set current-configuration display level 0 ip address
[Huawei] set current-configuration display level 0 aaa
[Huawei] set current-configuration display level 0 network
<Huawei> display current-configuration
# aaa # interface GigabitEthernet0/0/0 ip address 192.168.200.183 255.255.255.0 # interface LoopBack0 ip address 10.168.1.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 10.168.1.0 0.0.0.255 network 172.16.1.0 0.0.0.255 # return
<Huawei> system-view
[Huawei] set current-configuration display all level 0 aaa
<Huawei> display current-configuration
# aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user huawei password cipher %$%$^XcfPki5NVJ)ceVfc.;-f"Ei%$%$ local-user huawei privilege level 3 # interface GigabitEthernet0/0/0 ip address 192.168.200.183 255.255.255.0 # interface LoopBack0 ip address 10.168.1.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 10.168.1.0 0.0.0.255 network 172.16.1.0 0.0.0.255 # return