• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 关于我们

01-基础配置命令参考

目录

01-CLI命令

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

01-CLI命令


1 CLI

1.1  CLI命令

1.1.1  alias

alias命令用来为命令或命令字符串配置别名。

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

【命令】

alias alias command

undo alias alias

【缺省情况】

系统为部分常用命令定义了缺省别名,如表1-1所示。

表1-1 系统定义的缺省别名

缺省别名

命令

access-list

acl

end

return

erase

delete

exit

quit

hostname

sysname

logging

info-center

no

undo

show

display

write

save

 

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

alias:表示命令的别名,为1~20个字符的字符串,区分大小写。别名不能为“alias”,也不能包含空格。

command:表示配置别名的命令,可以为任意字符串。请用户保证该命令字符串能够被设备识别并执行,否则执行别名命令时将会失败。

【使用指导】

系统定义的缺省别名无法取消。

通过本命令用户可以为命令行指定一个或多个别名,也可以为命令行开头的一个或多个关键字配置多个别名,使其符合用户的使用习惯。

本命令可以为某条命令行配置别名,当执行该命令时可以直接使用别名以简化输入。例如将命令display ip routing-table的别名配置为shiprt,当需要使用display ip routing-table查看设备生效的配置时,直接输入shiprt即可。

本命令可以为命令行起始的一个或多个关键字配置别名,使其更符合用户习惯。所有使用该关键字开头的命令行都可以使用别名命令来执行。例如,为display ip命令定义的别名为ship,在使用所有以display ip关键字开头的命令行时,都可以使用ship进行配置。例如:

·     输入ship routing-table可以执行命令display ip routing-table

·     输入ship interface可以执行命令display ip interface

配置别名时,可以使用$n表示命令行中的参数或者关键字,这样既可以用别名替代部分关键字来简化输入,又可以根据实际需要指定不同的参数或者关键字,增加了灵活性。$n最多可以使用9次,n为1~9的整数,表示参数或关键字出现的顺序。比如,将命令display ip $1 | include $2的别名配置为shinc后,如果需要执行display ip routing-table | include Static命令来筛选并查看路由表中的所有静态路由信息,可直接执行shinc routing-table Static;同样如果需要执行display ip interface | include GigabitEthernet0/0/1,则可直接执行shinc interface GigabitEthernet0/0/1。

【举例】

# 配置命令display ip routing-table的别名为shiprt

<Sysname> system-view

[Sysname] alias shiprt display ip routing-table

[Sysname] shiprt

Destinations : 13        Routes : 13

Destination/Mask   Proto   Pre Cost        NextHop         Interface

0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0

3.3.3.3/32         Static  60  0           192.168.1.62    GigabitEthernet0/0/1

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

169.254.0.0/24     Direct  0   0           169.254.0.188   GigabitEthernet0/0/1

169.254.0.0/32     Direct  0   0           169.254.0.188   GigabitEthernet0/0/1

169.254.0.188/32   Direct  0   0           127.0.0.1       InLoop0

169.254.0.255/32   Direct  0   0           169.254.0.188   GigabitEthernet0/0/1

224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0

224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

# 配置命令display ip $1 | include $2的别名为shinc,同时使用别名命令筛选并查看路由表中的所有静态路由信息。

[Sysname] alias shinc display ip $1 | include $2

[Sysname] shinc routing-table Static

3.3.3.3/32         Static  60  0           192.168.1.62    GigabitEthernet0/0/1

【相关命令】

·     display alias

1.1.2  configuration reauthentication enable

configuration reauthentication enable命令用来开启高危命令二次认证功能。

undo configuration reauthentication enable命令用来关闭高危命令二次认证功能。

【命令】

configuration reauthentication enable

undo configuration reauthentication enable

【缺省情况】

高危命令二次认证功能处于关闭状态。

【视图】

系统视图

【缺省用户角色】

network-admin

【使用指导】

对于设备上的某些命令,如果操作不当,可能会导致设备断电、设备重启、业务中断、业务运行异常、重要文件被删除、配置被清除、用户无法登录、用户下线等现象发生。这样的命令称为“高危命令”,例如reboot命令。高危命令只能由有资质、且经过培训的维护人员执行。

为了防止误操作造成业务不可用,建议用户开启高危命令二次认证功能。

开启高危命令二次认证功能后,

·     对于无需认证即可登录设备的用户,则该用户执行高危命令也无需二次认证。

·     对于需要认证才能登录设备的用户,则输入高危命令,需要输入登录时输入的密码并通过身份验证后,才能开始执行对应的高危命令。undo configuration reauthentication enable命令本身也属于高危命令,需要进行二次认证。

【举例】

# 开启高危命令二次认证功能。

<Sysname> system-view

[Sysname] configuration reauthentication enable

# 执行reboot命令需要进行二次认证。

<Sysname> reboot

This command is disruptive or has significant impact on services. Please enter the login password again for reauthentication.

Password:

Start to check configuration with next startup configuration file, please wait.........DONE!

Current configuration will be lost after the reboot, save current configuration? [Y/N]:y

Please input the file name(*.cfg)[flash:/startup.cfg]

(To leave the existing filename unchanged, press the enter key):

flash:/startup.cfg exists, overwrite? [Y/N]:y

Validating file. Please wait...

Configuration is saved to device successfully.

This command will reboot the device. Continue? [Y/N]:y

Now rebooting, please wait...

# 关闭高危命令二次认证功能需要进行二次认证。

<Sysname> system-view

[Sysname] undo configuration reauthentication enable

This command is disruptive or has significant impact on services. Please enter the login password again for reauthentication.

Password:

[Sysname]

1.1.3  display { peer-device | with-peer-device }

display { peer-device | with-peer-device }命令用来查看对端设备的显示信息,或者用来同时查看本端设备和对端设备的显示信息。

【命令】

display command { peer-device | with-peer-device }

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【参数】

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

peer-device:显示对端设备的信息。

with-peer-device:追加显示对端设备的信息。指定本参数时,表示同时查看本端设备及对端设备的相应信息。不指定本参数时,表示仅显示对端设备的相应信息。

【使用指导】

在多机组网环境下,用户无需登录对端设备,在本设备上执行display command peer-device命令,即可查看对端设备的信息,方便用户管理和维护设备。执行display command with-peer-device命令,可以查看本端和对端设备的信息,方便对两台设备的配置和信息进行比较。关于多机配置同步的详细介绍请参考“基础配置”中的“多机配置同步”。

【举例】

# 同时显示用户视图下本端设备和对端设备上生效的配置。

<Sysname> display this with-peer-device

#

sysname sysname

#

system-working-mode standard

xbar load-single

password-recovery enable

lpu-type f-series

#

drni mad exclude interface GigabitEthernet0/0/1

drni system-mac 0001-0001-0001

drni system-number 1

drni system-priority 123

drni keepalive ip destination 1.1.1.1 source 1.1.1.2

#

scheduler logfile size 16

#

domain default enable system

#

security-enhanced level 2

#

return

------------------------  peer information  ------------------------

#

sysname sysname

#

system-working-mode standard

xbar load-single

password-recovery enable

lpu-type f-series

#

drni mad exclude interface GigabitEthernet0/0/1

drni system-mac 0001-0001-0001

drni system-number 2

drni system-priority 123

drni keepalive ip destination 1.1.1.2 source 1.1.1.1

#

scheduler logfile size 16

#

domain default enable system

#

security-enhanced level 2

#

return

1.1.4  display [ | [ by-linenum ] { begin | exclude | include } ]

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

【命令】

display command [ | { count | [ by-linenum ] { begin | exclude | include } regular-expression &<1-128> } ]

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【参数】

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

[ | { count | [ by-linenum ] { begin | exclude | include } regular-expression &<1-128> } ]:指定显示信息的过滤规则,其中:

·     count:统计display命令所查看显示信息的行数。

·     by-linenum:表示带行号显示。当多次使用正则表达式对显示信息过滤时,by-linenum参数只需要输入一次即可生效。不指定该参数时,表示不带行号显示。

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

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

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

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

·     &<1-128>:表示前面的参数最多可以输入128次。

【使用指导】

display命令查看显示信息时,用户可以使用正则表达式来过滤显示信息,并标注行号,以便快速的定位自己关注的信息。

对于正则表达式的形式,具有如下注意事项:

·     使用的正则表达式中如包含空格,可以将整个字符串包含在双引号中,或者整个字符串不带双引号,例如:display current-configuration | include interface A,或者display current-configuration | include "interface A"

·     带双引号时,双引号中间包含的字符串即为完整的过滤条件;

·     不带双引号时,从第一个非空格字符至最后一个非空格字符中间为一个完整的字符串,过滤时需要严格匹配,按STRING类型进行检查。例如,regular-expression="    interface A   "regular-expression=interface A是不同的过滤条件。

·     如果在正则表达式中使用>>>|这三个符号,建议将其包含在双引号中,否则会被作为关键字而不是过滤条件处理。

·     不支持过滤字符串中的单引号。

如果输入多个过滤条件,则显示满足所有条件的信息。

行号占5个字符,通常行号后面接“:”。当by-linenumbegin参数一起使用时,行号后面还可能接“-”,其中“:”表示该行符合匹配规则,“-”表示该行不符合匹配规则。

【举例】

# 查看包含VLAN的配置。

<Sysname> display current-configuration | include vlan

vlan 1

vlan 999

 port access vlan 999

# 显示日志缓冲区中包含SHELL字符串且包含VTY字符串的日志。

<Sysname> display logbuffer | include SEHLL | include VTY

%Feb  6 10:38:12:320 2020 Sysname SHELL/5/SHELL_LOGIN: VTY logged in from 169.254.100.171.

%Feb  6 10:52:32:576 2020 Sysname SHELL/5/SHELL_LOGOUT: VTY logged out from 169.254.100.171.

%Feb  6 16:03:27:100 2020 Sysname SHELL/5/SHELL_LOGIN: VTY logged in from 169.254.100.171.

%Feb  6 16:44:18:113 2020 Sysname SHELL/5/SHELL_LOGOUT: VTY logged out from 169.254.100.171.

# 查看当前配置,从包含“user-group”字符串的行开始到最后一行配置信息,并同时显示行号。(行号后为“:”表示该行包含“user-group”字符串,行号后为“-”表示该行不包含“user-group”字符串。)

<Sysname> display current-configuration | by-linenum begin user-group

  114:  user-group system

  115-  #

  116-  return

# 查看display current-configuration命令显示信息的行数。

<Sysname> display current-configuration | count

Total lines: 353

1.1.5  display >

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

【命令】

display command > filename

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【参数】

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

filename:文件名称,为1~63个字符的字符串。

【使用指导】

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:

    GigabitEthernet0/0/2

1.1.6  display >>

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

【命令】

display command >> filename

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【参数】

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

filename:文件名称,为1~63个字符的字符串。

【使用指导】

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

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

【举例】

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

<Sysname> display vlan 999 >> 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:

    GigabitEthernet0/0/2

 

 VLAN ID: 999

 VLAN type: Static

 Route interface: Configured

 IPv4 address: 192.168.2.1

 IPv4 subnet mask: 255.255.255.0

 Description: For LAN Access

 Name: VLAN 0999

 Tagged ports:   None

 Untagged ports:

    GigabitEthernet0/0/2

1.1.7  display alias

display alias命令用来查看命令别名的相关配置。

【命令】

display alias [ alias ]

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【参数】

alias:表示配置的命令别名。不指定该参数,则显示所有的已配置的命令别名。

【举例】

# 查看系统中配置的所有命令别名。

<Sysname> display alias

Index     Alias                Command key

1         logging              info-center

2         show                 display

3         shinc                display ip $1 | include $2

4         erase                delete

5         access-list          acl

6         no                   undo

7         exit                 quit

8         end                  return

9         hostname             sysname

10        write                save

# 查看别名命令shinc表示的命令字符串。

<Sysname> display alias shinc

Alias                Command key

shinc                display ip $1 | include $2

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

字段

描述

Index

索引号

Alias

别名

Command key

命令字符串

 

【相关命令】

·     alias

1.1.8  display history-command

display history-command命令用来显示当前登录用户历史命令缓冲区中的命令。

【命令】

display history-command

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【使用指导】

用户登录设备后,系统会给每个用户自动分配一个历史命令缓冲区,用于存放用户本次登录成功执行的命令行,以便用户查看和调用。历史命令缓存区有大小限制,缺省保存10条命令,用户也可以通过history-command max-size命令来修改大小。当数目达到上限时,系统会自动删除最早的记录,来保存最新成功执行的命令。

如果用户退出登录,系统会自动清除该历史命令缓存区的所有记录。

如果历史命令缓冲区中存在密码配置命令,为提高设备安全性,密码会被显示为******。

【举例】

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

<Sysname> display history-command

  system-view

  GigabitEthernet0/0/1

  quit

【相关命令】

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

1.1.9  display history-command all

display history-command all命令用来显示所有登录用户历史命令缓冲区中的命令。

【命令】

display history-command all

【视图】

任意视图

【缺省用户角色】

network-admin

【使用指导】

系统中有一个共享历史命令缓冲区,用于存放所有登录用户成功执行的命令行,以便用户查看(不能调用)。历史命令缓存区的大小与设备的型号有关,请以设备的实际情况为准。当数目达到上限时,系统会自动删除最早的记录,来保存最新成功执行的命令。

即便用户退出登录,系统也不会清除共享历史命令缓存区中该用户的历史命令记录。

如果历史命令缓冲区中存在密码配置命令,为提高设备安全性,密码会被显示为******。

【举例】

# 显示所有登录用户成功执行的历史命令以及执行的结果。

<Sysname> display history-command all

  Begin                End                   Terminal   Ip              User

  01/01/2021 09:03:17  01/01/2021 09: 03:17  vty0       192.168.1.26    **

  Cmd: display memory

  Result: succeeded

  01/01/2021 09:03:12  01/01/2021 09:03:15  con0        ****            **

  Cmd: display process

  Result: succeeded

  01/01/2021 09:03:00  01/01/2021 09:03:00  con0        ****            **

  Cmd: ip add 192.168.3.246 16

  Result: failed

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

字段

描述

Begin

命令行开始执行的日期时间

End

命令行执行结束的日期时间

Terminal

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

IP

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

User

如果用户使用scheme方式登录设备,该字段显示为执行命令的用户使用的登录用户名;如果使用其他方式登录设备,该字段显示为**

Cmd

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

Result

命令执行的结果

 

【相关命令】

·     display history-command

1.1.10  display hotkey

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

【命令】

display hotkey

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【举例】

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

<Sysname> display hotkey

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

 

           -Defined function 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.

 

           -Defined command hotkeys-

CTRL_G  display current-configuration

CTRL_L  display ip routing-table

CTRL_O  undo debugging all

 

           -Undefined hotkeys-

CTRL_T  NULL

CTRL_U  NULL

表1-4 display hotkey命令显示信息描述表

字段

描述

Defined function hotkeys

已定义的绑定功能的快捷键

Defined command hotkeys

已定义的绑定命令的快捷键

Undefined hotkeys

未定义的快捷键

 

关于各快捷键绑定的功能或命令的详细介绍请参见“hotkey”命令中的“快捷键的缺省绑定关系”表。

【相关命令】

·     hotkey

1.1.11  hotkey

hotkey命令用来修改快捷键的绑定关系。

undo hotkey命令用来恢复缺省情况。

【命令】

hotkey hotkey { command | function function | none }

undo hotkey hotkey

【缺省情况】

设备支持29个快捷键,各快捷键的缺省绑定关系如表1-5所示。

表1-5 快捷键的缺省绑定关系

快捷键

缺省绑定的功能或命令

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_G

display current-configuration,表示显示当前配置

CTRL_H

erase_the_character_to_the_left_of_the_cursor,表示删除光标左侧的一个字符

CTRL_K

abort_the_connection_request,表示终止呼出的连接

CTRL_L

display ip routing-table,表示显示IPv4路由表信息

CTRL_N

display_the_next_command_in_the_history_buffer,表示显示历史缓冲区中的下一条命令(密码配置命令会跳过)

CTRL_O

undo debugging all,表示关闭所有功能项的调试开关

CTRL_P

display_the_previous_command_in_the_history_buffer,表示显示历史缓冲区中的上一条命令(密码配置命令会跳过)

CTRL_R

redisplay_the_current_line,表示重新显示当前行信息

CTRL_T

未绑定任何命令行或功能

CTRL_U

未绑定任何命令行或功能

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,表示将光标所在位置指定为剪贴板的结束位置

 

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

hotkey:需要绑定的快捷键。必须为设备支持的快捷键,取值请参见表1-5,或执行hotkey ?命令,帮助出该参数的取值。

command:快捷键绑定的命令行。必须为设备上可成功执行的命令行。

function:快捷键绑定的功能。执行hotkey hotkey function ?命令,可以帮助出该参数的取值,关于各值的含义请参见表1-5

none:取消指定快捷键的绑定关系。配置该参数后,该快捷键将不绑定任何命令和功能。

【使用指导】

为方便用户快捷操作设备,设备支持29个快捷键,用户可以修改除“CTRL_]”外的28个快捷键的绑定关系。用户按下快捷键后,设备会立即执行对应的命令行或者功能。如果这些快捷键和用户登录终端定义的快捷键冲突,或者不符合用户的使用习惯,用户可使用该命令重新定义快捷键,甚至取消快捷键的绑定关系。

一个快捷键对应一个命令或功能,如果使用本命令多次定义同一快捷键,则最新配置生效。如果多次使用本命令将多个快捷键和同一命令、功能绑定,则这些绑定的快捷键均生效。

当用户使用终端软件与设备进行交互时,如果终端软件定义快捷键(包括用户可定义和系统定义快捷键),则快捷键会遵从终端软件的定义。

【举例】

# 将快捷键<Ctrl+U>和功能“将光标移动到当前行的开头”绑定。

<Sysname> system-view

[Sysname] hotkey ctrl_u function move_the_cursor_to_the_beginning_of_the_line

# 取消快捷键<Ctrl+A>的绑定关系。

<Sysname> system-view

[Sysname] hotkey ctrl_a none

【相关命令】

·     display hotkey

1.1.12  quit

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

【命令】

quit

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【使用指导】

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

【举例】

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

[Sysname-GigabitEthernet0/0/1] quit

[Sysname] quit

<Sysname>

【相关命令】

·     return

1.1.13  repeat

repeat命令用来重复执行历史记录命令。

【命令】

repeat [ number ] [ count times ] [ delay seconds ]

【视图】

任意视图

【缺省用户角色】

network-admin

【参数】

number:表示重复执行历史命令的条数,取值范围为1~256,缺省值为1。

count times:表示重复执行历史命令的次数,取值范围为0~4294967295,缺省值为0。如不指定该参数,则历史命令一直重复执行,直到执行用户线视图下设置的终止当前运行任务的快捷键才能停止执行该命令,默认的终止快捷键为<Ctrl+C>。关于终止当前执行任务的快捷键的设置,请参见“基础配置命令”中的“登录设备”。

delay seconds:表示重复执行历史命令的时间间隔,取值范围为0~4294967295,单位为秒,缺省值为1。

【使用指导】

重复执行历史命令时,系统将按照历史命令的下发顺序执行。例如,用户在某视图下依次执行命令a、b和c后,再执行repeat 3命令,则系统将按照a、b和c的顺序重复执行。

如果用户重复执行的历史命令中存在交互式命令,需要用户手动处理此交互式命令,直到交互式命令执行结束,历史命令才会继续被重复执行。

如果用户重复执行的历史命令中存在密码配置命令,系统会跳过密码配置命令

实际重复执行历史命令的条数取如下三者的最小值:

·     通过repeat命令设置的重复执行历史记录命令的条数;

·     通过history-command max-size命令设置当前用户线下最大可以存储的历史命令的条数;

·     当前实际存在的历史命令的条数。

【举例】

# 重复执行最近2条历史命令display cpu-usagedisplay clock,重复执行3次,时间间隔10秒。

<Sysname> repeat 2 count 3 delay 10

<Sysname> display cpu-usage

Slot 1 CPU 0 CPU usage:

      33% in last 5 seconds

      32% in last 1 minute

      33% in last 5 minutes

                                                                               

<Sysname> display clock

07:02:18.230 UTC Thu 02/19/2020

<Sysname> display cpu-usage

Slot 1 CPU 0 CPU usage:

      33% in last 5 seconds

      32% in last 1 minute

      33% in last 5 minutes

                                                                               

<Sysname> display clock

07:02:28.263 UTC Thu 02/19/2020

<Sysname> display cpu-usage

Slot 1 CPU 0 CPU usage:

      33% in last 5 seconds

      32% in last 1 minute

      33% in last 5 minutes

                                                                               

<Sysname> display clock

07:02:38.293 UTC Thu 02/19/2020

【相关命令】

·     display history-command

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

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

1.1.14  return

return命令用来从当前视图(除Tcl配置视图和Python shell外的任意非用户视图)直接退回到用户视图。

【命令】

return

【视图】

除Tcl配置视图和Python shell外的任意非用户视图

【缺省用户角色】

network-admin

network-operator

【使用指导】

用户也可以使用组合键<Ctrl+Z>从当前视图(除Tcl配置视图和Python shell外的任意非用户视图)直接退回到用户视图,效果等同于执行return命令。

Tcl配置视图和Python shell下退回到用户视图的方式分别为:

·     Tcl配置视图下请使用tclquit返回用户视图。

·     在Python shell下请通过执行exit()命令,从Python shell退回到用户视图。

【举例】

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

[Sysname-GigabitEthernet0/0/1] return

<Sysname>

【相关命令】

·     quit

1.1.15  screen-length disable

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

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

【命令】

screen-length disable

undo screen-length disable

【缺省情况】

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

【视图】

用户视图

【缺省用户角色】

network-admin

【使用指导】

在收集信息时建议关闭分屏显示功能,分屏显示功能处于关闭状态时,会一次显示所有信息,查看信息时,不建议关闭分屏显示功能,如果信息较多,则会连续刷屏,不方便立即查看。

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

【举例】

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

<Sysname> screen-length disable

【相关命令】

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

1.1.16  system-view

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

【命令】

system-view

【视图】

用户视图

【缺省用户角色】

network-admin

network-operator

【举例】

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

<Sysname> system-view

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

[Sysname]

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

新华三官网
联系我们