CLI 中的联机帮助
从命令行界面获取联机帮助
CLI 具有上下文相关的联机帮助功能,使您能够访问有关命令和语句的信息。
获取有关命令的帮助
CLI 命令和选项可能因平台和软件版本而异。CLI 命令层次结构的每个级别都提供有关可用命令的信息。可以键入问号 (?) 以获取有关命令的上下文相关帮助。
如果在命令行提示符下键入问号,CLI 将列出可用的命令和选项。例如,要查看顶级作模式命令的列表,其结果如下:
user@host>
?Possible completions: clear Clear information in the system configure Manipulate software configuration information file Perform file operations help Provide help information mtrace Trace mtrace packets from source to receiver. monitor Real-time debugging ping Ping a remote target quit Exit the management session request Make system-level requests restart Restart a software process set Set CLI properties, date, time, craft display text show Show information about the system ssh Open a secure shell to another host start Start a software process telnet Telnet to another host test Diagnostic debugging commands traceroute Trace the route to a remote host user@host>如果在输入命令或命令选项的完整名称后键入问号,则 CLI 将列出可用的命令和选项,然后重新显示键入的命令名称和选项。
user@host>
clear?Possible completions: arp Clear address-resolution information bgp Clear BGP information chassis Clear chassis information firewall Clear firewall counters igmp Clear IGMP information interfaces Clear interface information ilmi Clear ILMI statistics information isis Clear IS-IS information ldp Clear LDP information log Clear contents of a log file mpls Clear MPLS information msdp Clear MSDP information multicast Clear Multicast information ospf Clear OSPF information pim Clear PIM information rip Clear RIP information route Clear routing table information rsvp Clear RSVP information snmp Clear SNMP information system Clear system status vrrp Clear VRRP statistics information user@host> clear如果在命令名称中间键入问号,则 CLI 会列出与您迄今为止输入的字母匹配的可能命令补全。然后,它会重新显示您键入的字母。例如,要列出以字母 c开头的所有作模式命令,请键入以下内容:
user@host>
c?Possible completions: clear Clear information in the system configure Manipulate software configuration information user@host> c有关使用问号或帮助命令的介绍性信息,您还可以键入
help并按 Enter:user@host>
help
获取有关语句或命令中字符串的帮助
您可以使用该 help 命令显示有关语句或命令名称中包含的文本字符串的帮助:
help apropos string
string 是您想要获取帮助的文本字符串。使用该字符串来匹配语句或命令名称,以及匹配为语句或命令显示的帮助字符串。
如果字符串包含空格,请用引号 (“ ”) 将其括起来。您还可以使用标准 UNIX 样式正则表达式语法为字符串指定正则表达式。
对于需要输入数据类型为 STRING 的语句或命令,支持的字符集如下:
任何可打印的 ASCII 字符
对于带空格的字符,用双引号括起来。
要使用双引号作为输入,应用 '\' 转义。
注意:除了从双引号转义之外,字符串中不支持转义字符。
属性支持的字符范围为 0 到 65499 个字符。
字符串类型标识符支持的字符范围为 1 到 255 个字符。
在配置模式下,此命令显示与指定字符串匹配的语句名称和帮助文本。在作模式下,此命令将显示与指定字符串匹配的命令名称和帮助文本。
获取有关配置语句的帮助
您可以使用 and help reference 命令help topic根据语句名称中包含的文本显示帮助:
help topicwordhelp referencestatement-name
该 help topic 命令根据 Junos OS 演化版 配置指南中显示的信息显示语句的使用准则。该 help reference 命令根据 Junos OS 演化版 配置指南中的摘要说明显示有关语句的摘要信息。
获取有关系统日志消息的帮助
您可以使用以下 help syslog 命令根据系统日志标记显示帮助:
help syslog syslog-tag
命令 help syslog 将显示系统日志消息的内容。
CLI 在线帮助功能
省略语句的帮助
如果在某个特定层级省略了必需的语句,当您尝试从该层级移动或在配置模式下发出 show 命令时,将出现一条消息,指示缺少哪条语句。例如:
[edit protocols pim interface et-0/0/0] user@host#topWarning: missing mandatory statement: 'mode' [edit] user@host#showprotocols { pim { interface et-0/0/0 { priority 4; version 2; # Warning: missing mandatory statement(s): 'mode' } } }
使用 CLI 命令补全
Junos OS 演化版 CLI 为您提供命令补全选项,使作系统能够根据您键入的前几个字母识别命令和选项。也就是说,您不必总是记住或键入 CLI 的完整命令或选项名称即可识别它。
要显示所有可能的命令或选项补全,请键入部分命令,后跟问号。
要完成部分键入的命令或选项,请按
Tab或Space。如果部分键入的字母以唯一标识命令的字符串开头,则会显示完整的命令名称。否则,将出现提示,指示您输入了不明确的命令,并显示可能的补全功能。
命令补全也适用于其他字符串,例如文件名、接口名称和用户名。要显示所有可能的值,请键入一个部分字符串,后跟一个问号。要完成字符串,请按 Tab。
在配置模式下使用命令补全
CLI 命令完成功能也适用于配置模式中的命令和配置语句。具体而言,要显示所有可能的命令或语句,请键入部分字符串,然后紧跟问号。要完成部分键入的命令或语句,请按 Tab 或 Space。
显示有关 CLI 命令的提示
要获取有关 CLI 命令的提示,请发出命令 help tip cli 。每次输入命令时,都会出现一个新提示。例如:
user@host>help tip cliJunos tip: Use 'request system software validate' to validate the incoming software against the current configuration without impacting the running system. user@host>help tip cliJunos tip: Use 'commit and-quit' to exit configuration mode after the commit has succeeded. If the commit fails, you are left in configuration mode.
您还可以输入以help tip clinumber将小费与数字相关联。这使您能够稍后回忆提示。例如:
user@host>help tip cli 10JUNOS tip: Use '#' in the beginning of a line in command scripts to cause the rest of the line to be ignored. user@host>help tip cliJUNOS tip: Use the 'apply-groups' statement at any level of the configuration hierarchy to inherit configuration statements from a configuration group. user@host>
也可以看看
CLI 资源管理器概述
CLI 资源管理器是一款 Web 应用程序,可帮助您浏览 Junos OS 演化版 配置语句和命令。CLI 资源管理器列出了 Junos OS 演化版 在不同平台和软件版本中支持的所有配置语句和命令。
要查看可用的配置语句和命令,可以使用以下任一过滤选项:
按产品系列过滤 — 要按产品系列查找 CLI 参考信息,可以选择“所有产品”或选择任何特定产品。
例如:ACX 系列、EX 系列。
按数字或字母过滤 — 要按数字或字母查找 CLI 参考信息,您可以选择“全部”或按数字“3”或“8”或任何字母(“A”、“B”、“C”)过滤。
例如,如果选择字母“A”,则会出现 、
aaa clients (TDF)等aaaaaa-access-profile (L2TP LNS)命令。按普通搜索选项过滤 — 要使用此选项过滤命令和语句,请输入搜索条件。
例如,如果输入数字“3”,则包含数字“3”的所有命令和语句都会出现在搜索结果中。
单击搜索结果中的链接时,系统会将您定向到描述用户指南中引用的命令或语句的页面。
要浏览 Junos OS 演化版 配置语句和命令,请参阅 CLI 资源管理器。