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

01-基础配置命令参考

目录

01-CLI命令

本章节下载 01-CLI命令  (138.14 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S12500/S12500/Command/Command_Manual/H3C_S12500_CR-R7128-6W710/01/201211/762999_30005_0.htm

01-CLI命令


1 CLI命令

1.1  CLI命令

1.1.1  command-alias enable

command-alias enable命令用来使能命令关键字别名功能。

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

【命令】

command-alias enable

undo command-alias enable

【缺省情况】

命令关键字别名功能处于关闭状态。

【视图】

系统视图

【缺省用户角色】

network-admin

mdc-admin

【使用指导】

使能命令关键字别名功能后,command-alias mapping命令的配置才生效。如果暂时不使用这些别名,可以先关闭命令关键字别名功能。关闭命令关键字别名功能不会删除已经配置的别名。

【举例】

# 使能命令关键字别名功能。

<Sysname> system-view

[Sysname] command-alias enable

【相关命令】

·              command-alias mapping

·              display command-alias

1.1.2  command-alias mapping

command-alias mapping命令用来给指定的命令行关键字配置别名。

undo command-alias mapping命令用来取消相应配置。

【命令】

command-alias mapping cmdkey alias

undo command-alias mapping cmdkey

【缺省情况】

没有为命令行关键字配置别名。

【视图】

系统视图

【缺省用户角色】

network-admin

mdc-admin

【参数】

cmdkey:表示设备当前支持的命令行的第一个关键字或者undo命令的第二关键字,必须是完整的关键字名。

alias:表示关键字的别名,该别名不能与设备当前支持的命令行的第一个关键字或者undo命令的第二关键字相同。

【使用指导】

通过本命令用户可以为命令行的第一个关键字指定一个别名,使其符合用户的使用习惯。比如将display关键字的别名配置为show后,就可以用show关键字来代替display关键字。如果要执行display clock命令,就可以用show clock来代替。

只有配置command-alias enable后,配置的别名才生效。

【举例】

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

<Sysname> system-view

[Sysname] command-alias mapping display show

通过以上配置后,命令行中的display关键字就可以用show关键字来代替。比如:原命令为display clock,通过以上配置后,就可以输入show clock

【相关命令】

·              command-alias enable

·              display command-alias

1.1.3  display | { begin | exclude | include }

display | { begin | exclude | include }命令用来使用正则表达式对显示信息进行过滤。

【命令】

display command | { begin | exclude | include } regular-expression

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【参数】

command:命令行关键字,取值可以通过输入?来获得。

|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。

begin:从包含指定正则表达式的行开始显示。

exclude:只显示不包含指定正则表达式的行。

include:只显示包含指定正则表达式的行。

regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。

【使用指导】

display命令查看显示信息时,用户可以使用正则表达式来过滤显示信息,以便快速的找到自己关注的信息。关于正则表达式的详细描述请参考“基础配置指导”中的“CLI”。

【举例】

# 查看包含VLAN的配置。

<Sysname> display current-configuration | include vlan

vlan 1

vlan 999

 port access vlan 999

1.1.4  display | by-linenum

display | by-linenum命令用来查看带行号的显示信息。

【命令】

display command | by-linenum

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【参数】

command:命令行关键字,取值可以通过输入?来获得。

【使用指导】

使用本命令时,系统在显示信息的同时会自动在每行显示信息的前面添加行号。以便当显示信息较多时,能够迅速定位到某行信息。

【举例】

# 显示VLAN 999信息的同时显示行号。

<Sysname> display vlan 999 | by-linenum

1:   VLAN ID: 999

2:   VLAN type: Static

3:   Route interface: Configured

4:   IP address: 192.168.2.1

5:   Subnet mask: 255.255.255.0

6:   Description: For LAN Access

7:   Name: VLAN 0999

8:   Tagged ports:   None

9:   Untagged ports:

10:      GigabitEthernet3/0/1

1.1.5  display >

display >命令用来将显示信息独立保存到指定文件。

【命令】

display command > filename

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【参数】

command:命令行关键字,取值可以通过输入?来获得。

filename:文件名称。

【使用指导】

display命令显示的内容通常是统计信息、功能是否使能以及功能的相关参数配置,这些信息在设备运行过程中会随着时间或者用户的配置而改变。使用本命令可以将当前显示信息保存到指定文件,可供用户随时比对和查看。

执行本命令时,如果filename不存在,系统会先创建该文件,再保存;如果filename已存在,则会覆盖原文件的内容。

【举例】

# 将display vlan 1的显示信息保存到指定文件vlan.txt。

<Sysname> display vlan 1 > vlan.txt

查看vlan.txt的内容,验证display >命令的执行效果。

<Sysname> more vlan.txt

VLAN ID: 1

 VLAN type: Static

 Route interface: Not configured

 Description: VLAN 0001

 Name: VLAN 0001

 Tagged ports:   None

 Untagged ports:

    GigabitEthernet3/0/2

1.1.6  display >>

display >>命令用来将显示信息以追加方式保存到指定文件。

【命令】

display command >> filename

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【参数】

command:命令行关键字,取值可以通过输入?来获得。

filename:文件名称。

【使用指导】

display命令显示的内容通常是统计信息、功能是否使能以及功能的相关参数配置,这些信息在设备运行过程中会随着时间或者用户的配置而改变。使用本命令可以将当前显示信息保存到指定文件,可供用户随时比对和查看。

执行本命令时,如果filename不存在,系统会先创建该文件,再保存。如果filename已存在,则新保存的内容会追加到文件filename的尾部。

【举例】

# 将display vlan 999的显示信息以追加方式保存到指定文件vlan.txt。

<Sysname> display vlan 999 >> vlan.txt

<Sysname>

查看vlan.txt的内容,验证display >>命令的执行效果。

<Sysname> more vlan.txt

VLAN ID: 1

 VLAN type: Static

 Route interface: Not configured

 Description: VLAN 0001

 Name: VLAN 0001

 Tagged ports:   None

 Untagged ports:

    GigabitEthernet3/0/2

 

 VLAN ID: 999

 VLAN type: Static

 Route interface: Configured

 IP address: 192.168.2.1

 Subnet mask: 255.255.255.0

 Description: For LAN Access

 Name: VLAN 0999

 Tagged ports:   None

 Untagged ports:

    GigabitEthernet3/0/1

1.1.7  display command-alias

display command-alias命令用来显示命令关键字别名功能的相关配置。

【命令】

display command-alias

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【举例】

# 显示命令关键字别名功能的相关配置。

<Sysname> display command-alias

Command alias is enabled

Index Alias                Command key

1     ping1                ping

2     ssh1                 ssh

表1-1 display command-alias命令显示信息描述表

字段

描述

Command alias is

命令关键字别名功能的使能状态:enabled表示已使能;disabled表示未使能

index

索引号

alias

别名

command key

关键字

 

【相关命令】

·              command-alias enable

·              command-alias mapping

1.1.8  display history-command

display history-command命令用来显示当前登录用户成功执行的历史命令。

【命令】

display history-command

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【使用指导】

系统会把当前登录用户最近成功执行的命令保存到历史命令缓存区,以便用户查看和随时调用。历史命令缓存区有大小限制,缺省保存10条命令,用户也可以通过history-command max-size命令来修改大小。

【举例】

# 显示历史命令缓存区内保存的命令。

<Sysname> display history-command

 system-view

 vlan 2

 quit

【相关命令】

·              history-command max-size(基础配置命令参考/登录设备)

1.1.9  display history-command all

display history-command all命令用来显示所用登录用户成功执行的历史命令。

【命令】

display history-command all

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【使用指导】

系统会把所有用户最近成功执行的命令保存到历史命令缓存区,以便用户查看和随时调用。历史命令缓存区有大小限制,最多可以保存1024条。当数目达到上限时,系统会自动删除最早的记录,来保存最新成功执行的命令。

【举例】

# 显示所用登录用户成功执行的历史命令。

<Sysname> display history-command all

  Date       Time     Terminal   Ip              User

  03/16/2012 20:03:33 vty0       192.168.1.26    **

  Cmd:dis his all

 

  03/16/2012 20:03:29 vty0       192.168.1.26    **

  Cmd:sys                                          

表1-2 display history-command all命令显示信息描述表

字段

描述

Date

执行命令行的日期

Time

执行命令行的时间

Terminal

执行命令的用户使用的登录用户界面

Ip

执行命令的用户使用的登录IP

User

执行命令的用户使用的登录用户名

Cmd

执行的命令(和用户的输入保持一致)

 

【相关命令】

·              display history-command

1.1.10  display hotkey

display hotkey命令用来显示系统支持的快捷键及其含义。

【命令】

display hotkey

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【举例】

# 显示系统支持的快捷键及其含义。

<Sysname> display hotkey

----------------- Hotkeys -----------------

           -Defined command hotkeys-

CTRL_G display current-configuration

CTRL_L display ip routing-table

CTRL_O undo debugging all

 

           -Undefined command hotkeys-

CTRL_T NULL

CTRL_U NULL

 

           -System-reserved hotkeys-

CTRL_A  Move the cursor to the beginning of the line.

CTRL_B  Move the cursor one character to the left.

CTRL_C  Stop the current command.

CTRL_D  Erase the character at the cursor.

CTRL_E  Move the cursor to the end of the line.

CTRL_F  Move the cursor one character to the right.

CTRL_H  Erase the character to the left of the cursor.

CTRL_K  Abort the connection request.

CTRL_N  Display the next command in the history buffer.

CTRL_P  Display the previous command in the history buffer.

CTRL_R  Redisplay the current line.

CTRL_V  Paste text from the clipboard.

CTRL_W  Delete the word to the left of the cursor.

CTRL_X  Delete all characters from the beginning of the line to the cursor.

CTRL_Y  Delete all characters from the cursor to the end of the line.

CTRL_Z  Return to the User View.

CTRL_]  Kill incoming connection or redirect connection.

ESC_B   Move the cursor back one word.

ESC_D   Delete all characters from the cursor to the end of the 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_<   Move the cursor to the beginning of the clipboard.

ESC_>   Move the cursor to the end of the clipboard.

【相关命令】

·              hotkey

1.1.11  hotkey

hotkey命令用来为快捷键指定对应的命令行。

undo 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 }

【缺省情况】

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

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

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

·              <Ctrl+T>没有关联任何命令行。

·              <Ctrl+U>没有关联任何命令行。

【视图】

系统视图

【缺省用户角色】

network-admin

mdc-admin

【参数】

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

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

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

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

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

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

【使用指导】

通过快捷键用户可以简便、快捷的操作设备,使用display hotkey命令可以查看设备支持的所有快捷键及其含义。

【举例】

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

<Sysname> system-view

[Sysname] hotkey ctrl_t display tcp status

【相关命令】

·              display hotkey

1.1.12  quit

quit命令用来使用户从当前视图退回到上一层视图。

【命令】

quit

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【使用指导】

如果当前是用户视图,执行quit后,会断开当前连接,退出系统。

【举例】

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

[Sysname-GigabitEthernet3/0/1] quit

[Sysname] quit

<Sysname>

1.1.13  return

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

【命令】

return

【视图】

除用户视图外的任意视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【使用指导】

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

【举例】

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

[Sysname-GigabitEthernet3/0/1] return

<Sysname>

1.1.14  screen-length disable

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

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

【命令】

screen-length disable

undo screen-length disable

【缺省情况】

用户登录后将遵循用户界面下的screen-length设置。screen-length设置的缺省情况为:允许分屏显示,下一屏显示24行数据。

【视图】

用户视图

【缺省用户角色】

network-admin

mdc-admin

【使用指导】

禁止分屏显示时,会一次显示所有信息,如果信息较多,则会连续刷屏,不方便立即查看。

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

【举例】

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

<Sysname> screen-length disable

【相关命令】

·              screen-length(基础配置命令参考/登录设备)

1.1.15  system-view

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

【命令】

system-view

【视图】

用户视图

【缺省用户角色】

network-admin

network-operator

mdc-admin

mdc-operator

【举例】

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

<Sysname> system-view

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

[Sysname]

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

新华三官网
联系我们