• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

基础配置命令参考

目录

02-CLI命令

本章节下载 02-CLI命令  (134.75 KB)

docurl=/cn/Service/Document_Software/Document_Center/Wlan/WA/WA1208E/Command/Command_Manual/H3C_WA_CR-6W101/01/201205/745583_30005_0.htm

02-CLI命令


l          不同型号产品的特性功能支持情况略有不同,详细请参见“特性差异化列表” 部分的介绍。

l          设备支持的接口类型和编号与设备的实际情况相关,本手册涉及以太网接口的配置举例统一使用Eth口举例说明。实际使用中请根据具体设备的接口类型和编号进行配置。

 

1 CLI命令

1.1  CLI命令

1.1.1  command-alias enable

【命令】

command-alias enable

undo command-alias enable

【视图】

系统视图

【缺省级别】

2:系统级

【参数】

【描述】

command-alias enable命令用来使能命令行别名功能。undo command-alias enable命令用来关闭命令行别名的功能。

缺省情况下,命令行别名功能处于关闭状态,即用户不能给命令行指定别名。

【举例】

# 使能命令行别名功能。

<Sysname> system-view

[Sysname] command-alias enable

# 关闭命令行别名功能。

<Sysname> system-view

[Sysname] undo command-alias enable

1.1.2  command-alias mapping

【命令】

command-alias mapping cmdkey alias

undo command-alias mapping cmdkey

【视图】

系统视图

【缺省级别】

2:系统级

【参数】

cmdkey:表示将被别名替代的现有的某个命令的第一关键字,必须是完整的关键字名。

alias:表示命令的别名,该别名不能与设备上已有命令的第一个关键字相同。

【描述】

command-alias mapping命令用来给指定的命令行配置别名,undo command-alias mapping命令用来取消命令行别名的配置。

缺省情况下,命令行没有配置别名。

【举例】

# 配置关键字display的别名为show。

<Sysname> system-view

[Sysname] command-alias mapping display show

通过以上配置后,设备支持的原来命令中的display关键字就可以用show关键字来代替。比如:原命令为display clock,通过以上配置后,就可以输入show clock来查看系统时间了。

# 取消display的别名配置。

<Sysname> system-view

[Sysname] undo command-alias mapping display

1.1.3  command-privilege

【命令】

command-privilege level level view view command

undo command-privilege view view command

【视图】

系统视图

【缺省级别】

3:管理级

【参数】

level level:命令的级别,取值范围为0~3。

view view:命令行视图的名称,view的取值中shell表示用户视图。该参数必须是command所在的视图,具体命令所在视图请参见该命令解释的“【视图】”小节的描述。

command:需要设置的命令。

【描述】

command-privilege命令用来设置指定视图下的命令的级别。undo command-privilege命令用来恢复缺省情况。

缺省情况,各个视图下的每条命令都有指定的级别,详细介绍请参见“基础配置指导”中的“系统基本配置操作”中的“级别介绍”小节。

命令级别共分为访问、监控、系统、管理4个级别,分别对应标识0、1、2、3。管理员可以根据用户需要改变命令的级别,实现低级别用户可以使用部分高级别命令的功能。用户操作设备时,可以使用等于或者低于用户本身级别的所有命令。例如:某用户的级别是3级,则该用户可以使用3级及3级以下的命令。

需要注意的是:

l              通常情况下,建议用户不要修改缺省的命令级别或者在专业人员的指导下进行修改,以免造成操作和维护上的不便甚至给设备带来安全隐患。

l              配置command-privilege命令时,command参数必须是需要设置的命令的完整形式,即必须输入命令的所有关键字以及参数,参数只要在取值范围之内即可,对具体值没有限制。比如tftp server-address { get | put | sget } source-filename [ destination-filename ] [ source { interface interface-type interface-number | ip source-ip-address } ]命令的缺省级别为3,现配置命令command-privilege level 0 view shell tftp 1.1.1.1 put a.cfg,则当级别为0的用户登录设备时,可以执行tftp server-address put source-filename命令(比如tftp 192.168.1.26 put syslog.txt),但不能携带destination-filenamesource参数,也不能执行getsget操作。

l              配置undo command-privilege命令时,command参数可以使用省略形式,即只输入命令最前面的部分参数。比如执行undo command-privilege view system ftp,会将系统视图下所有以ftp关键字开头的命令(如ftp server aclftp server enableftp timeout等)的级别恢复到缺省级别。如果当前已经修改了ftp server enableftp timeout命令的级别,但只想将ftp server enable命令的级别恢复到缺省级别,则需要使用命令undo command-privilege view system ftp server。

l              如果将某视图下的某条命令的级别修改为低于缺省级别的级别,请注意相应的修改quit以及进入该视图命令的级别。比如interfacesystem-view命令的缺省级别均为2(系统级),如果要将interface命令开放给级别为1的用户使用,则需要配置command-privilege level 1 view shell system-view、command-privilege level 1 view system interface gigabitethernet 1/0/1、command-privilege level 1 view system quit,以便级别为1的用户登录设备后,能够进入系统视图、执行interface ethernet命令、退回用户视图。

【举例】

# 将用户视图下的命令system-view的级别修改为3级。(缺省情况级别是2或3的用户登录设备后可以使用system-view命令,通过以下配置只有级别是3的用户才可以使用该命令进入系统视图,对设备进行配置,从而增强了设备的安全性)

<Sysname> system-view

[Sysname] command-privilege level 3 view shell system-view

1.1.4  display command-alias

【命令】

display command-alias

【视图】

任意视图

【缺省级别】

1:监控级

【参数】

【描述】

display command-alias命令用来显示当前用户设置的命令行及其别名。

【举例】

# 显示当前用户设置的命令行及其别名。

<Sysname> display command-alias

Command alias is enabled

index  alias                        command key

1      show                         display

1.1.5  display history-command

【命令】

display history-command

【视图】

任意视图

【缺省级别】

1:监控级

【参数】

【描述】

display history-command命令用来显示当前用户最近执行过的有效历史命令,以便用户查看之前的配置。目前系统最多支持显示256条历史命令。

相关配置可参考命令history-command max-size

【举例】

# 显示当前用户最近执行过的有效历史命令(显示信息与用户当前的配置有关)。

<Sysname> display history-command

  system-view

  quit

  display current-configuration

1.1.6  display hotkey

【命令】

display hotkey

【视图】

任意视图

【缺省级别】

1:监控级

【参数】

【描述】

display hotkey命令用来显示系统中快捷键的分配信息。

【举例】

# 显示系统中快捷键的分配信息。

<Sysname> display hotkey

----------------- HOTKEY -----------------

 

            =Defined hotkeys=

Hotkeys  Command

CTRL_G   display current-configuration

CTRL_L   display ip routing-table

CTRL_O   undo debugging 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.    

1.1.7  hotkey

【命令】

hotkey { CTRL_G | CTRL_L | CTRL_O | CTRL_T | CTRL_U } command

undo hotkey { CTRL_G | CTRL_L | CTRL_O | CTRL_T | CTRL_U }

【视图】

系统视图

【缺省级别】

2:系统级

【参数】

CTRL_G:表示为快捷键<Ctrl+G>指定一条命令。

CTRL_L:表示为快捷键<Ctrl+L>指定一条命令。

CTRL_O:表示为快捷键<Ctrl+O>指定一条命令。

CTRL_T:表示为快捷键<Ctrl+T>指定一条命令。

CTRL_U:表示为快捷键<Ctrl+U>指定一条命令。

command:快捷键关联的命令行。

【描述】

hotkey命令用来为快捷键指定对应的命令行。undo hotkey命令用来恢复系统的缺省值。

缺省情况下,系统为<Ctrl+G>、<Ctrl+L>、<Ctrl+O>三个快捷键指定了对应的命令行,其它快捷键缺省值为空。

l              <Ctrl+G>对应命令display current-configuration(显示当前配置);

l              <Ctrl+L>对应命令display ip routing-table(显示IPv4路由表信息);

l              <Ctrl+O>对应命令undo debugging all(关闭设备支持的所有功能项的调试开关)。

用户完全可以根据自己的需要改变它们的定义。

【举例】

# 指定命令display tcp status的快捷键为<Ctrl+T>。

<Sysname> system-view

[Sysname] hotkey ctrl_t display tcp status

# 显示快捷键的配置信息。

[Sysname] display hotkey

----------------- HOTKEY -----------------

 

            =Defined hotkeys=

Hotkeys  Command

CTRL_G   display current-configuration

CTRL_L   display ip routing-table

CTRL_O   undo debugging 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.

1.1.8  quit

【命令】

quit

【视图】

任意视图

【缺省级别】

0:访问级(用户视图下)

2:系统级(其它视图下)

【参数】

【描述】

quit命令用来使用户从当前视图退回到上一层视图。如果当前是用户视图,执行quit后,会断开当前连接,退出系统。

【举例】

# 从接口Ethernet1/0/1视图返回到系统视图,再返回到用户视图。

[Sysname-Ethernet1/0/1] quit

[Sysname] quit

<Sysname>

1.1.9  return

【命令】

return

【视图】

除用户视图外的任意视图

【缺省级别】

2:系统级

【参数】

【描述】

return命令用来从当前视图(非用户视图)直接退回到用户视图。

用户也可以使用组合键<Ctrl+Z>从当前视图(非用户视图)直接退回到用户视图,效果等同于执行return命令。

相关配置可参考命令quit

【举例】

# 从接口Ethernet1/0/1视图退回到用户视图。

[Sysname-Ethernet1/0/1] return

<Sysname>

1.1.10  screen-length disable

【命令】

screen-length disable

undo screen-length disable

【视图】

用户视图

【缺省级别】

1:监控级

【参数】

【描述】

screen-length disable命令用来禁用当前用户的分屏显示功能。undo screen-length disable用来启用当前用户的分屏显示功能。

缺省情况下,用户登录后将遵循用户界面下的screen-length设置。screen-length设置的缺省情况为:允许分屏显示,下一屏显示24行数据。(screen-length命令的详细介绍请参见“登录设备命令”)

需要注意的是:该配置只对当前用户有效,用户重登录后将恢复到缺省情况。

【举例】

# 禁用当前用户的分屏显示功能。

<Sysname> screen-length disable

1.1.11  system-view

【命令】

system-view

【视图】

用户视图

【缺省级别】

2:系统级

【参数】

【描述】

system-view命令用来从用户视图进入系统视图。

相关配置可参考命令quitreturn

【举例】

# 从用户视图进入系统视图。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname]

 


不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们