Navigating
The following sections describe navigating in the MD-CLI.
Tree structure
The MD-CLI tree contains the following elements from the Nokia YANG models:
- 
container This is an element that contains other elements. 
Containers
In the following example, tcp-keepalive and gnmi are containers.
tcp-keepalive {
    admin-state disable
    idle-time 600
    interval 15
    retries 4
}
gnmi {
    admin-state enable
    auto-config-save false
}- 
list This is a sequence of list entries. 
Lists
In the following example, the entire set of interfaces is a list.
        group "group-1" {
            connect-retry 600
            keepalive 33
        }
        group "group-2" {
            description "Text description for group-2"
            local-preference 8
        }- 
list entry This is an element similar to a container with multiple instances where each list entry is identified by the values of its keys. 
List entries
In the following example, group ‟group-2” is identified in this way.
router "Base" {
    bgp {
        group "group-1" {
            connect-retry 600
            keepalive 33
        }
        group "group-2" {
            description "Text description for group-2"
            local-preference 8
        }
    }
}- 
key This is a unique identifier for a list entry. 
Keys
In the following example, ‟group-1” and ‟group-2” are unique identifiers.
router "Base" {
    bgp {
        group "group-1" {
            connect-retry 600
            keepalive 33
        }
        group "group-2" {
            description "Text description for group-2"
            local-preference 8
        }
    }
}- 
leaf This is an element that does not contain any other elements and has a data type (for example, string or integer). A leaf can also be defined with no data type where the leaf takes no parameter value (that is, an empty leaf). 
Leafs
tcp-keepalive {
    admin-state disable
    idle-time 600
    interval 15
    retries 4
}
gnmi {
    admin-state enable
    auto-config-save false
}- 
leaf-list This is an element that contains a sequence of values of a particular data type. 
Leaf-list
In the following example, ‟policy” is a leaf-list element.
    policy ["policy-a" "policy-b" "policy-c"]
- 
leaf-list entry This is one of the values of a leaf-list. 
Leaf-list entries
In the following example, ‟policy-a”, ‟policy-b”, and ‟policy-c” are leaf-list entries.
    policy ["policy-a" "policy-b" "policy-c"]
The following terms are also used:
- 
keyword This is an element with a name defined by SR OS. For example, enumerated values, leaf names, and container names. 
- 
variable parameter This is an element with a name defined by the user. For example, descriptions, names, integer or string leaf values. 
- 
immutable element This is an element that can only be configured in the transaction in which the parent element is created. It cannot be modified while the parent element exists. 
- 
choice element This is an element which is part of a set of mutually exclusive elements. Setting a choice element clears all configuration from the other choice elements. 
Elements in the tree structure
In the following example, admin-state (leaf name), enable (enumerated value), and connect-retry (leaf name) are keywords, and ‟800” is a variable parameter.
*[ex:/configure router "Base" bgp]
A:admin@node-2# info
    admin-state enable
    connect-retry 800
Managing the router configuration using the MD-CLI involves accessing and configuring the appropriate elements (containers, lists, leafs, and leaf-lists).
The MD-CLI tree shows the commands and parameters (also known as elements) that are available in a hierarchical output.
tree detail command output
In the following, the bold elements are containers (or container lists) which contain leafs (or leaf-lists).
*[ex:/configure system]
A:admin@node-2# tree detail
+-- alarms
|   +-- admin-state <keyword>
|   +-- apply-groups <reference>
|   +-- apply-groups-exclude <reference>
|   +-- max-cleared <number>
+-- allow-boot-license-violations <boolean>
+-- apply-groups <reference>
+-- apply-groups-exclude <reference>
+-- boot-bad-exec <string>
+-- boot-good-exec <string>
+-- central-frequency-clock
|   +-- apply-groups <reference>
|   +-- apply-groups-exclude <reference>
|   +-- bits
|   |   +-- input
|   |   |   +-- admin-state <keyword>
|   |   +-- interface-type <keyword>
|   |   +-- output
|   |   |   +-- admin-state <keyword>
|   |   |   +-- line-length <keyword>
|   |   |   +-- ql-minimum <keyword>
|   |   |   +-- source <keyword>
|   |   |   +-- squelch <boolean>
|   |   +-- ql-override <keyword>
|   |   +-- ssm-bit <number>
|   +-- ptp
|   |   +-- admin-state <keyword>
|   +-- ql-minimum <keyword>
|   +-- ql-selection <boolean>
|   +-- ref-order
|   |   +-- fifth <keyword>
|   |   +-- first <keyword>
|   |   +-- fourth <keyword>
|   |   +-- second <keyword>
|   |   +-- third <keyword>
---snip---
Command prompt
The MD-CLI command prompt displays on two lines. The first line contains the following information:
- 
baseline status indicator This indicator displays an exclamation mark (!) to indicate an out-of-date baseline when in a configuration mode. 
- 
uncommitted changes indicator This indicator displays an asterisk (*) to indicate uncommitted configuration changes when in a configuration mode. 
- 
configuration mode reference When in a configuration mode, a configuration mode reference is displayed: - 
in round brackets for an explicit configuration workflow 
- 
prepended to the context, separated by a colon for an implicit configuration workflow 
 The configuration mode reference can be one of the following: - ex
- exclusive mode
- gl
- global mode
- pr
- private mode
- ro
- read-only mode
 
- 
- 
context The present working context is displayed in square brackets ([]) when in operational or configuration mode. 
For an explicit configuration workflow, the format of the first line is as follows:
<baseline status indicator > <uncommitted changes indicator> (<configuration mode>) [context]
Explicit configuration workflow
(ro)[/]
(ex)[/configure router "Base" bgp]
For an implicit configuration workflow, the format of the first line is as follows:
<baseline status indicator> <uncommitted changes indicator> [<configuration mode>:context]
Implicit configuration workflow
[ro:/configure]
*[ex:/configure]
The second line contains the following information:
- 
                    CPM The active CPM slot can be A or B on 7450 ESS and 7750 SR routers, and A,B,C, or D on 7950 XRS routers. 
- 
user The user is the name of the current user for this session. 
- 
name The name is the system name, as configured with the configure system name command. The system name can change dynamically during the session if it is configured to a different name. 
The format of the second line is as follows:
CPM:user@name#
Two-line prompt usage
The following examples display the two-line prompt in different modes.
- prompt in operational mode[/] A:admin@node-2#
- prompt in the operational root, with exclusive configuration
                    mode(ex)[/] A:admin@node-2#
- prompt in operational mode show router
                    bgp[/show router "Base" bgp] A:admin@node-2#
- prompt in exclusive configuration mode configure router
                    bgp(ex)[/configure router "Base" bgp] A:admin@node-2#
- prompt in exclusive configuration mode configure router bgp
                    with uncommitted
                    changes*(ex)[/configure router "Base" bgp] A:admin@node-2#
- implicit configuration workflow prompt for a session in private configuration
                    mode, with a present working context of configure router bgp
                    with uncommitted changes in the private candidate datastore, and the baseline
                    datastore
                    out-of-date!*[pr:/configure router "Base" bgp] A:admin@node-2#
Environment commands
The MD-CLI has two environment configurations:
- the global environment configuration in the configure system management-interface cli md-cli context, which is persistent in the saved configuration file. Changes made to the global environment configuration apply only to new sessions and do not affect current sessions.
- the per-session environment configuration in the environment context, which is not persistent and applies only to each user's current session. The global environment configuration is copied to the per-session environment configuration when a new session is started.
See the 7450 ESS, 7750 SR, 7950 XRS, and VSR MD-CLI Command Reference Guide for information about the environment commands in the MD-CLI.
Command aliases
The MD-CLI can be customized to provide an enhanced user experience through the use of command aliases.
Aliases can be configured to execute a user-defined command name that performs a specific action. Supported actions include:
- executing an MD-CLI command
- executing a Python application
Creating aliases
Aliases can be created and modified in the per-session context or the global configuration configure system management-interface cli md-cli environment context. Aliases (or elements of the aliases) that are deleted in the per-session environment context return to their defaults (usually to the state of the global environment alias defined in the configuration context).
When an alias is configured, the alias acts as a substitute for a command or set of commands that can then be executed. Nokia recommends defining alias names that are meaningful to the user. Alias names must not use any string that is an MD-CLI root element, such as admin, or that is an MD-CLI global command, such as insert. Aliases are displayed in command completion and ? help, where applicable.
The MD-CLI command history displays what was entered in the CLI. Instead of recording the resultant operation, the history records the alias name and any arguments.
Typical use cases for MD-CLI command aliases include:
- shortcuts for navigating MD-CLI contexts
- creating new MD-CLI output commands
- aliasing existing MD-CLI commands
Mounting an alias
Aliases are mounted at specific points in the MD-CLI contexts. Aliases may be mounted globally using the mount-point global option. A globally mounted alias may be executed from any MD-CLI context.
Execution of a globally mounted alias
The following example shows the execution of a globally mounted alias that creates the alias up for the back command.
command-alias {
    alias "up" {
        admin-state enable
        cli-command "back"
        mount-point global { }
    }
}
[ex:/configure router "Base" bgp]
A:admin@node-2# up  # Moved back one level by typing “up”
[ex:/configure router "Base"]
A:admin@node-2# uPress Tab  # Integrated into MD-CLI command completion
 up
 update
[ex:/configure router "Base"]
A:admin@node-2# up ?  # Accepts parameters and displays ? help for aliased command
 [[levels] <number>]
 <number> - <1..4294967295>
 Default  - 1
    Number of levels to move upAlternatively, an alias may be mounted at one or more specific locations, which limits the contexts from which the alias may be executed. The execution of such an alias can be considered equivalent to executing the resultant operation from the present working context of the mount point.
Execution of an alias mounted in the /show and /tools perform contexts
command-alias {
    alias "hello-from-some-places-only" {
        admin-state enable
        python-script "hello"
        mount-point "/show" { }
        mount-point "/tools perform" { }
    }
}
[/]
A:admin@node-2# show hello-from-some-places-only
Hi
[/]
A:admin@node-2# tools perform hello-from-some-places-only
Hi
[/show]
A:admin@node-2# hello-from-some-places-only
Hi
[/tools]
A:admin@node-2# hello-from-some-places-only
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
MINOR: MGMT_CORE #2201: Unknown element - 'hello-from-some-places-only'Mount points may contain lists. Where lists are provisioned, the keys must be provided. If lists have default keys, these may be omitted. List keys do not need to be present in the current configuration.
Alias using a nonexistent list key in a mount point
The key vpn3 does not exist as a current VPRN service. When vpn3 is entered on the command line, the resultant configuration shows the string vpn3 enclosed in quotation marks, escaped by the backslash (\) character.
[ex:/configure system management-interface cli md-cli environment command-alias]
A:admin@node-2# info /state service vprn Press Tab
 <service-name>
 "vpn1"
 "vpn2"
[ex:/configure system management-interface cli md-cli environment command-alias alias "list-keys-in-mount-point-example"]
A:admin@node-2# mount-point "/state service vprn vpn3"
*[ex:/configure system management-interface cli md-cli environment command-alias alias "list-keys-in-mount-point-example"]
A:admin@node-2# info
    admin-state enable
    python-script "hello"
    mount-point "/state service vprn \"vpn3\"" { }Alias automatically available
When the list key is created, the alias automatically becomes available in the context, as shown in the following example.
[/]
A:admin@node-2# state service vprn "vpn3" list-keys-in-mount-point-example
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MINOR: MGMT_CORE #2201: Unknown element - 'list-keys-in-mount-point-example'
[/]
A:admin@node-2# edit-config exclusive
INFO: CLI #2060: Entering exclusive configuration mode
INFO: CLI #2061: Uncommitted changes are discarded on configuration mode exit
(ex)[/]
A:admin@node-2# configure service vprn vpn3
*(ex)[/configure service vprn "vpn3"]
A:admin@node-2# customer "1"
*(ex)[/configure service vprn "vpn3"]
A:admin@node-2# commit
(ex)[/configure service vprn "vpn3"]
A:admin@node-2# state service vprn vpn3 list-keys-in-mount-point-exampleConfiguring aliases to execute Python applications
An alias can execute a configured Python application. The alias python-script command can reference a Python application configured in the /configure python python-script context.
See Accounting and authorization of aliases for information about authorizing Python application execution using the alias command.
Configuring aliases to execute MD-CLI commands
- the list key has a default entry
- the list key is the last element of the CLI command
Simplified navigation within the MD-CLI
command-alias {
    alias "go-to-alias" {
        admin-state enable
        cli-command "configure system management-interface cli md-cli environment command-alias"
        mount-point global { }
    }
}
[ex:/configure router "Base" bgp]
A:admin@node-2# go-to-alias
[ex:/configure system management-interface cli md-cli environment command-alias]
A:admin@node-2#List (router) with a default list key ("Base")
[/state system]
A:admin@node-2# show router-auth-stats
====================================================================
Authentication Global Statistics
====================================================================
Client Packets Authenticate Fail     : 0
Client Packets Authenticate Ok       : 0
====================================================================Key provided as a parameter
A list key can be omitted if the last element of the CLI command string is a list. This allows the key to be provided as a parameter when executing the alias, as shown in the following example.
command-alias {
    alias "vprn-state" {
        admin-state enable
        cli-command "info candidate /state service vprn"
        mount-point "/show" { }
    }
}
[/]
A:admin@node-2# show vprn-state
                     ^^^^^^^^^^
MINOR: CLI #2001: Missing element value - 'service-name'
[/]
A:admin@node-2# show vprn-state vpn1
    oper-service-id 1
    oper-state up
    sap-count 2
    sdp-bind-count 0
    template-used ""
    creation-origin manual
    vrtr-id 2
    oper-router-id 255.0.0.0
    oper-route-distinguisher-type auto
...snip...Extra parameters executed
Aliases can also accept arguments, allowing extra parameters to be executed, as shown in the following example.
[/]
A:admin@node-2# show vprn-state vpn1 interface "test1" ipv4 icmp
    statistics {
        icmp-in-msgs 0
        icmp-in-errors 0
        icmp-in-dest-unreachables 0
        icmp-in-redirects 0
        icmp-in-echos 0
        icmp-in-echo-replies 0
        icmp-in-time-exceeds 0
        icmp-in-src-quenches 0
        icmp-in-timestamps 0
        icmp-in-timestamp-replies 0
        icmp-in-address-masks 0
        icmp-in-address-mask-replies 0
        icmp-in-parm-problems 0
        icmp-out-msgs 0
        icmp-out-errors 0
        icmp-out-dest-unreachables 0
        icmp-out-redirects 0
        icmp-out-echos 0
        icmp-out-echo-replies 0
        icmp-out-time-exceeds 0
        icmp-out-src-quenches 0
        icmp-out-timestamps 0
        icmp-out-timestamp-replies 0
        icmp-out-address-masks 0
        icmp-out-address-mask-replies 0
        icmp-out-parm-problems 0
        icmp-out-discards 0
    }Include output modifiers in definitions
Aliases that execute CLI commands may also include output modifiers in the definitions. In the following example, the alias bgp-top-line outputs the line from show router bgp summary that uses the output match modifier to select a specific string:
command-alias {
    alias "bgp-top-line" {
        admin-state enable
        cli-command "show router bgp summary | match \"AS:\""
        mount-point global { }
    }
}
[/]
A:admin@node-2# bgp-top-line
 BGP Router ID:255.0.0.0        AS:65535       Local AS:65535Accounting and authorization of aliases
Aliases have specific accounting and authorization rules, as shown in the following configuration example.
command-alias {
    alias "my-python-alias" {
        admin-state enable
        python-script "hello"
        mount-point global { }
    }
    alias "my-cli-alias" {
        admin-state enable
        cli-command "info running /state service vprn"
        mount-point global { }
    }
    alias "my-cli-python-alias" {
        admin-state enable
        cli-command "pyexec cf3:\hello.py"
        mount-point global { }
    }
}The command entered by the user on the MD-CLI command line is sent to the accounting system, including all arguments supplied to the alias.
For example, if the user enters my-cli-alias vpn1, the string my-cli-alias vpn1 is sent to the accounting system. If the user enters my-python-alias, the string my-python-alias is sent to the accounting system.
The string sent to the authorization system depends on whether cli-command or python-script is configured in the alias context.
When an alias uses a CLI command, the resulting MD-CLI command is sent to the authorization system. For example, if the user enters my-cli-alias vpn1, the string sent to the authorization system is info running /state service vprn vpn1. If the user enters my-cli-python-alias, the string sent to the authorization system is pyexec cf3:\hello.py
If the alias is configured with the python-script option, the string sent to the authorization server is the referenced Python application name prefaced by the string python-script. This allows Python applications initiated with the pyexec command to be authorized independently of those initiated from within MD-CLI command aliases. Administrators can predefine approved Python applications that may be executed by users who otherwise have no access to run the pyexec command.
For example, if the operator enters my-python-alias, the string sent to the authorization server is python-script \”hello\”.
Customizing per-session environment settings
The environment can be customized for all sessions in the configuration under the configure system management-interface cli md-cli environment context, or per session using the environment command. When a new MD-CLI session is started, the per-session environment configuration is copied from the global environment configuration. Changes made to the global environment configuration after the session begins apply only to new sessions and do not affect current sessions. Changes made to the environment parameters for a session apply only for that session.
The per-session environment is accessed by entering environment at the operational root or with /environment from any other mode or context. Changes made in the per-session environment are immediate.
The info command displays the difference between the per-session environment and the configured global environment parameters. Therefore, for a new MD-CLI session, the info command has no output, as the per-session environment is the same as the global environment. The info detail command displays the current values in the global environment for all parameters.
Customizing the session prompt
Customizing the uncommitted changes indicator
As the default setting of the environment configuration, the uncommitted changes indicator is displayed as part of the command prompt. This setting can be modified per session or it can be changed for all MD-CLI sessions by changing the environment configuration.
The uncommitted-changes-indicator command under the environment prompt context suppresses or displays the change indicator for an MD-CLI session. Environment changes are applied immediately and are lost when the session disconnects.
*[/environment prompt]
A:admin@node-2# uncommitted-changes-indicator false
[/environment prompt]
A:admin@node-2#
[/environment prompt]
A:admin@node-2# uncommitted-changes-indicator true
*[/environment prompt]
A:admin@node-2#
Customizing the line preceding the command prompt
By default, a blank line precedes the command prompt. This setting can be modified for each MD-CLI session.
The newline command under the environment prompt context suppresses or displays a new line before the prompt.
[/]
A:admin@node-2# environment prompt
[/environment prompt]
A:admin@node-2# newline false
[/environment prompt]
A:admin@node-2# newline true
[/environment prompt]
A:admin@node-2#Customizing the context information in the command prompt
By default, the context is displayed in the command prompt. This setting can be modified for each MD-CLI session.
The context command under the environment prompt context suppresses or displays the current context.
[/environment prompt]
A:admin@node-2# context false
[]
A:admin@node-2# context true
[/environment prompt]
A:admin@node-2#
Customizing the date and time output
By default, the timestamp is not displayed before the command prompt. This setting can be modified for each MD-CLI session.
The timestamp command under the environment prompt context suppresses or displays the timestamp.
Suppress or display the timestamp
[/environment prompt]
A:admin@node-2# timestamp true
Tue, 16 Feb 2021 16:37:26 UTC
[/environment prompt]
A:admin@node-2# timestamp false
[/environment prompt]
A:admin@node-2#
The environment time-display command configures the time zone display to UTC or local time (as configured in configure system time).
Configure the time zone display
[/environment]
A:admin@node-2# time-display ?
 time-display <keyword>
 <keyword> - (local|utc)
 Default   - local
    Time zone to display timeThe environment time-format command specifies the format for the time display.
Specify the format for the time display
[/environment]
A:admin@node-2# time-format ?
 time-format <keyword>
 <keyword> - (iso-8601|rfc-1123|rfc-3339)
 Default   - rfc-3339
    Format to display the date and timeShow the time in the format defined by ISO 8601
[/state cpm "a" hardware-data]
A:admin@node-2# software-last-boot-time
    software-last-boot-time "2020-09-01 23:27:17 UTC"
Show the time in the format defined by RFC 1123
[/state cpm "a" hardware-data]
A:admin@node-2# software-last-boot-time
    software-last-boot-time "Tue, 01 Sep 2020 23:27:17 UTC"
Show the time in the format defined by RFC 3339
[/state cpm "a" hardware-data]
A:admin@node-2# software-last-boot-time
    software-last-boot-time 2020-09-01T23:27:17.0+00:00
Customizing the progress indicator
The progress indicator appears on the line immediately following the command and disappears when the MD-CLI command completes or when output is available to display. The indicator is a display of dynamically changing dots.
Progress indicator
[ex:/configure]
A:admin@node-2# compare
...                    # progress indicator displays here as dots 
The delay interval can be configured using the delay command or the indicator can be disabled with the admin-state disable command under the environment progress-indicator context.
Customizing the progress indicator for logged sessions
[/environment progress-indicator]
A:admin@node-2# ?
 admin-state          - Administrative state of the progress indicator
 delay                - Delay before progress indicator is displayed
 type                 - Progress indicator output style
Customizing the pagination setting
The environment more command enables pagination when configured to true and disables pagination when configured to false.
Using the environment more command
[/]
A:admin@node-2# environment more true
[/]
A:admin@node-2# show system security management
===============================================================================
Server Global
===============================================================================
Telnet:
Administrative State         : Enabled
Operational State            : Up
Telnet6:
Administrative State         : Disabled
Operational State            : Down
FTP:
Administrative State         : Disabled
Operational State            : Down
SSH:
Administrative State         : Enabled
Operational State            : Up
NETCONF:
Administrative State         : Disabled
Operational State            : Down
GRPC:
Administrative State         : Disabled
Operational State            : Down
--(more)--(39%)--(lines 1-23/55)--The pagination setting can be overridden by using | no-more for a single command. As with pagination disabled, the output is displayed completely without any prompts to continue.
Overriding the pagination setting
[/]
A:admin@node-2# show system security management | no-more
Customizing the console settings
The default size for a console terminal is 80 characters wide by 24 lines long. The environment console command can be used to change these settings.
[/environment]
A:admin@node-2# console ?
 console
 length               - Number of lines displayed on the screen
 width                - Number of columns displayed on the screen
Customizing the message level security settings
The INFO: CLI messages are displayed by default. The environment message-security-level command suppresses the INFO messages by changing the setting to warning.
[/environment message-severity-level]
A:admin@node-2# cli ?
 cli <keyword>
 <keyword> - (warning|info)
 Default   - info
    Message severity threshold for CLI messagesFollowing are examples of INFO: CLI messages that are suppressed when the setting is changed to warning.
INFO: CLI #2051: Switching to the classic CLI engine
INFO: CLI #2052: Switching to the MD-CLI engine
INFO: CLI #2054: Entering global configuration mode
INFO: CLI #2056: Exiting global configuration mode 
INFO: CLI #2055: Uncommitted changes are present in the candidate configuration
INFO: CLI #2057: Uncommitted changes are kept in the candidate configuration
Customizing configuration output display
Default values are always displayed in the info detail command output and not in the info command output. Use the environment info-output always-display admin-state command to display the values of the admin-state element in the info command output (without using the detail option), even if these values are set to the default. Enabling the admin-state command allows the info command output to always show the admin-state value without showing all the configured, default, and unconfigured values that are displayed using the info detail command. For more information, see Using the info command.
In the following configuration output, the admin-state for port 1/1/2 with a default configuration is not displayed using the info command. The admin-state is displayed after the environment info-output always-display admin-state command is configured to true.
[ex:/configure port 1/1/2]
A:admin@node-2# info
[ex:/configure port 1/1/2]
A:admin@node-2# /environment info-output always-display admin-state
[ex:/configure port 1/1/2]
A:admin@node-2# info
    admin-state disablePreventing changes to environment settings
The environment datastore is subject to AAA command authorization. A user can be prevented from modifying the global environment settings or the per-session environment settings, or both.
In the following configuration output, entry 113 blocks user ‟tstuser” from modifying the global environment settings. In addition, entry 114 prevents the user from changing the per-session environment settings.
(ro)[/configure system security aaa local-profiles profile "tstuser"]
A:admin@node-2# info
    default-action permit-all
    entry 113 {
        action deny
        match "configure system management-interface cli md-cli environment"
    }
    entry 114 {
        action deny
        match "environment"
    }
[ex:/configure system management-interface cli md-cli environment]
A:tstuser@node-2# prompt timestamp
MINOR: MGMT_CORE #2020: Permission denied
[ex:configure system management-interface cli md-cli environment]
A:tstuser@node-2# /environment
MINOR: MGMT_CORE #2020: Permission denied
[ex:/configure system management-interface cli md-cli environment]
A:tstuser@node-2#
Using online help
A short help description is displayed immediately when the question mark (?) is entered (without needing to press Enter).
Help displayed from the operational root level
[/]
A:admin@node-2# ?
 admin                 + Enter the administrative context for system operations
 bof                   + Enter the bof context
 clear                 + Clear statistics or reset operational state
 configure             + Enter the configuration context
 debug                 + Enter the debug context
 environment           + Configure the environment settings for this session
 file                  + Perform file operations
 li                    + Enter the lawful intercept context
 monitor               + Show operational information at an interval
 password              - Change the local user or an administrative password
 show                  + Show operational information
 state                 + Show state information
 tools                 + Enter the tools context for troubleshooting
 Global commands:
 back                  - Move back one or more levels
 delete                - Delete an element
 edit-config           - Enter a configuration context
 enable                - Enable administrative mode
 exec                  - Execute commands from a file
 exit                  - Return to the previous context or to operational root
 history               - Show the command history
 info                  - Show the information under the present working context
 logout                - Exit the CLI session
 oam                   - Perform OAM tests
 ping                  - Ping an IP address or DNS name
 pwc                   - Show the present working context
 pyexec                - Execute a Python application
 ssh                   - SSH to an IP address or DNS name
 telnet                - Telnet to an IP address or DNS name
 top                   - Move to the top level of the context
 traceroute            - Show the route taken to an IP address or DNS name
 tree                  - Show the command tree under the present working contextHelp displayed in exclusive configuration mode
? help output lists additional commands available in exclusive configuration mode. The ? help is context-sensitive.
(ex)[/]
A:admin@node-2# ?
 admin                 + Enter the administrative context for system operations
 clear                 + Clear statistics or reset operational state
 configure             + Enter the configuration context
 environment           + Configure the environment settings for this session
 file                  + Perform file operations
 monitor               + Show operational information at an interval
 password              - Change the local user or an administrative password
 show                  + Show operational information
 state                 + Show state information
 tools                 + Enter the tools context for troubleshooting
 Global commands:
 back                  - Move back one or more levels
 delete                - Delete an element
 edit-config           - Enter a configuration context
 enable                - Enable administrative mode
 exec                  - Execute commands from a file
 exit                  - Return to the previous context or to operational root
 history               - Show the command history
 info                  - Show the information under the present working context
 insert                - Insert an element into a user-ordered list
 logout                - Exit the CLI session
 oam                   - Perform OAM tests
 ping                  - Ping an IP address or DNS name
 pwc                   - Show the present working context
 pyexec                - Execute a Python application
 quit-config           - Exit the candidate configuration mode
 ssh                   - SSH to an IP address or DNS name
 telnet                - Telnet to an IP address or DNS name
 top                   - Move to the top level of the context
 traceroute            - Show the route taken to an IP address or DNS name
 tree                  - Show the command tree under the present working context
 Configuration commands:
 annotate              - Annotate a configuration element with a comment
 commit                - Commit the candidate configuration
 compare               - Compare changes between datastores
 copy                  - Copy a configuration element to another
 discard               - Discard changes in the candidate datastore
 rename                - Rename a list element
 update                - Update the candidate baseline
 validate              - Validate changes in the candidate datastore
Help results depend on cursor position
The help results may depend on the cursor position. The following example shows the router command syntax, followed by available commands after entering the router context.
[ex:/configure]
A:admin@node-2# router?
 router [[router-name] <string>]
 [router-name]         - Administrative router name
 aggregates            + Enter the aggregates context
 allow-icmp-redirect   - Allow ICMP redirects on the management interface
 allow-icmp6-redirect  - Allow IPv6 ICMP redirects on the management interface
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 autonomous-system     - AS number advertised to peers for this router
 bfd                   + Enter the bfd context
 bgp                   + Enable the bgp context
 bier                  + Enable the bier context
 class-forwarding      - Allow class-based forwarding over IGP shortcuts
 confederation         + Enter the confederation context
 description           - Text description
 dhcp-server           + Enter the dhcp-server context
 dns                   + Enter the dns context
 ecmp                  - Maximum equal-cost routes for routing table instance
 
---snip---
? output with more detail
In the following ? output, similar information is shown, with more details provided for configuring the router command, including the allowable string length and default value for the command.
[ex:/configure]
A:admin@node-2# router ?
 router [[router-name] <string>]
 [[router-name] <string>]
 <string> - <1..64 characters>
 Default  - "Base"
    Administrative router name
 aggregates            + Enter the aggregates context
 allow-icmp-redirect   - Allow ICMP redirects on the management interface
 allow-icmp6-redirect  - Allow IPv6 ICMP redirects on the management interface
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 autonomous-system     - AS number advertised to peers for this router
 bfd                   + Enter the bfd context
 bgp                   + Enable the bgp context
 bier                  + Enable the bier context
 class-forwarding      - Allow class-based forwarding over IGP shortcuts
 confederation         + Enter the confederation context
 description           - Text description
 dhcp-server           + Enter the dhcp-server context
 dns                   + Enter the dns context
 ecmp                  - Maximum equal-cost routes for routing table instance
 
 ---snip---Indicators in the online help
The following table describes the indicators available in the online help.
| Symbol | Description | 
|---|---|
| + | Indicates a container or list | 
| - | Indicates a leaf, a leaf-list, a list or container with no leafs, or a global command (if in the operational root) | 
| ^ | Indicates a mandatory element (an element that must be configured before the configuration is considered valid) | 
| : | Indicates the first element of a group of choice elements that are mutually exclusive | 
In the following help display example, the containers are eth-cfm, domain, and association. The leafs are apply-groups, apply-groups-exclude, dns, format, level, mac, md-index, and name, while level is also a mandatory element.
[ex:/configure]
A:admin@node-2# eth-cfm ?
 eth-cfm
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 default-domain        + Enter the default-domain context
 domain                + Enter the domain list instance[ex:/configure eth-cfm]
A:admin@node-2# domain ?
 [md-admin-name] <string>
 <string> - <1..64 characters>
    Unique domain name[ex:/configure eth-cfm]
A:admin@node-2# domain dom-name ?
 domain
 Immutable fields      - level, dns, mac, name, format, md-index
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 association           + Enter the association list instance
 level                 ^ Maintenance Domain Level (MD Level)
 md-index              - The index of the Maintenance Domain (MD)
 Mandatory choice: md-name
 dns                  :- Domain name like text string derived from a DNS name
 format               :- Maintenance domain name not to be provided
 mac                  :- Maintenance domain MAC name
 name                 :- Maintenance domain name as an ASCII stringDescriptions and format guidelines for leafs and leaf-lists
When online help is entered for a leaf or leaf-list, a short description of the element is displayed after the element type. The valid input values for the element are also listed, as shown in the following examples.
The description string for the VPRN service can have a length of 1 to 80 characters.
description string for a VPRN service
*[ex:/configure service vprn "5"]
A:admin@node-2# description ?
 description <string>
 <string> - <1..80 characters>
    Text description
The ? help for the autonomous-system command lists the valid number range, followed by a short description of the parameter.
autonomous-system command with the valid number range
*[ex:/configure service vprn "5"]
A:admin@node-2# autonomous-system ?
 autonomous-system <number>
 <number> - <1..4294967295>
    AS number advertised to peers for this router
A parameter value may have a unit type associated with it.
ingress-buffer-allocation command with an associated unit type
*[ex:/configure qos sap-ingress "sap-pname" policer 6]
A:admin@node-2# mbs ?
 mbs (<number> | <keyword>)
 <number>  - <0..268435456> - bytes
 <keyword> - auto           - bytes
 Default   - auto
    High priority violate threshold of PIR leaky bucketThe owner command refers to the script policy name that is configured through the configure system script-control script-policy context. The name is a string of 1 to 32 characters.
Parameter that is a reference to another parameter
*[ex:/configure log event-handling handler "h-name" entry 5]
A:admin@node-2# script-policy owner ?
 owner <reference>
 <reference> - <1..32            - configure system script-control script-
                characters>         policy <./name> owner <owner>
 Default     - TiMOS CLI
    Script policy owner
Immutable elements
An immutable element can only be configured in the transaction in which the parent element is created. It cannot be modified while the parent element exists. Any modification to an immutable element in model-driven interfaces causes SR OS to automatically delete the parent element and recreate it with the new value for the immutable element.
Immutable elements defined in online help
[ex:/configure eth-cfm]
A:admin@node-2# domain example_domain ?
 domain
 Immutable fields      - level, dns, mac, name, format, md-index
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 association           + Enter the association list instance
 level                 ^ Maintenance Domain Level (MD Level)
 md-index              - The index of the Maintenance Domain (MD)
 Mandatory choice: md-name
 dns                  :- Domain name like text string derived from a DNS name
 format               :- Maintenance domain name not to be provided
 mac                  :- Maintenance domain MAC name
 name                 :- Maintenance domain name as an ASCII string[ex:/configure eth-cfm]
A:admin@node-2# domain example_domain level ?
  level <number>
 <number> - <0..7>
 'level' is: mandatory, immutable
    Maintenance Domain Level (MD Level)
    Warning: Modifying this element recreates
    'configure eth-cfm domain "example_domain"' automatically for the new value
    to take effect.
Mutually exclusive choice elements
Elements that are part of a choice are listed in a separate section in the online help. Mandatory choices are listed first. Each choice contains a set of mutually exclusive elements or groups of elements. The first element of a group is indicated with a colon (:).
The following example shows a set of two mutually exclusive choice elements for an ingress queue rate. If configuring one of the choice elements, either the cir and fir values can be configured or the police value.
*[ex:/configure qos sap-ingress "ing-1" queue 1 rate]
A:admin@node-2# ?
 pir                   - Administrative PIR
 Choice: rate-cir-fir-or-police
 cir                  :- Administrative CIR
 fir                   - Administrative FIR
 police               :- Drop the traffic feeding into queue above the PIR rateOptional indicators in the online help
The following help display is an example of optional indicators.
Optional indicators
The square brackets ([]) around slot-number indicate that the slot-number keyword is optional when entering the command.
[ex:/configure]
A:admin@node-2# card ?
 [slot-number] <number>
 <number> - <1..20>
    Slot number within the chassisThe card context can be entered as one of the following.
[ex:/configure]
A:admin@node-2# card slot-number 5
or
[ex:/configure]
A:admin@node-2# card 5
Angle brackets (<>) indicate a variable name and the vertical bar (|) indicates a choice.
sub-group command
For the sub-group command, a number in the range of 1 to 8 can be entered, or one of the keywords auto-iom or auto-mda.
*[ex:/configure lag "lag-8" port 1/1/1]
A:admin@node-2# sub-group ?
 sub-group (<number> | <keyword>)
 <number>  - <1..8>
 <keyword> - (auto-iom|auto-mda)
 Default   - 1
 'sub-group' is: immutable
    Subgroup of the port in the LAG
    Warning: Modifying this element recreates
    'configure lag "lag-8" port 1/1/1' automatically for the new value to take
    effect.
Available commands
See the 7450 ESS, 7750 SR, 7950 XRS, and VSR MD-CLI Command Reference Guide for more information about all available commands.
See Editing configuration in this guide for more information about the configuration commands.
The following commands are available at the operational root level of the MD-CLI hierarchy.
[/]
A:admin@node-2# ?
 bof                   + Enter the bof context
 configure             + Enter the configure context
 debug                 + Enter the debug context
 environment           + Enter the environment context
 li                    + Enter the li context
Global commands are available from various levels of the MD-CLI hierarchy.
 Global commands:
 admin                 + Enter the administrative context for system operations
 back                  - Move back one or more levels
 clear                 + Clear statistics or reset operational state
 delete                - Delete an element
 edit-config           - Enter a configuration mode
 enable                - Enable administrative mode
 exec                  - Execute commands from a file
 exit                  - Return to the previous context or to operational root
 file                  + Perform file operations
 history               - Show the command history
 info                  - Show the information under the present working context
 logout                - Exit the CLI session
 monitor               + Show operational information at an interval
 oam                   - Perform OAM tests
 password              - Change the local user password
 perform               + Perform troubleshooting and debugging
 ping                  - Ping an IP address or DNS name
 pwc                   - Show the present working context
 pyexec                - Execute a Python application
 reset                 + Clear statistics or reset operational state
 show                  + Show operational information
 ssh                   - SSH to an IP address or DNS name
 state                 + Show state information
 telnet                - Telnet to an IP address or DNS name
 tools                 + Perform troubleshooting and debugging
 top                   - Move to the top level of the context
 traceroute            - Show the route taken to an IP address or DNS name
 tree                  - Show the command tree under the present working context
Configuration commands are available within a configuration mode. However, some commands are not visible within specific configuration modes; for example, the configuration commands available in read-only configuration mode are limited.
configuration commands in read-only configuration mode
 compare               - Compare changes between datastores
 validate              - Validate changes in the candidate datastoreconfiguration commands in exclusive configuration mode
 annotate              - Annotate a configuration element with a comment
 commit                - Commit the candidate configuration
 compare               - Compare changes between datastores
 copy                  - Copy a configuration element to another
 discard               - Discard changes in the candidate configuration
 load                  - Load contents into the candidate configuration
 rename                - Rename a list element
 replace               - Match and replace values in the candidate configuration
 rollback              - Roll back to a previous configuration
 update                - Update the candidate baseline
 validate              - Validate changes in the candidate configurationNavigating hierarchy levels
The following commands can be used to navigate the MD-CLI hierarchy (context) levels:
- 
pwc The pwc command displays the present working context with all keyword and variable parameters. (ex)[/] A:admin@node-2# configure (ex)[/configure] A:admin@node-2# card 1 (ex)[/configure card 1] A:admin@node-2# mda 2 *(ex)[/configure card 1 mda 2] A:admin@node-2# network *(ex)[/configure card 1 mda 2 network] A:admin@node-2# pwc Present Working Context: configure card 1 mda 2 network- 
pwc previous The pwc previous command displays the previous working context. *[ex:/configure card 1 mda 2 network] A:admin@node-2# pwc previous Previous Working Context: configure card 1 mda 2
- 
pwc path-type The pwc command has several options to display the path in different formats. - 
model-path Displays a YANG-modeled format that can be used with RESTCONF-based management systems. 
- 
gnmi-path Displays a format that can be used with gNMI streaming telemetry. 
- 
cli-path Displays a single-line version of the MD-CLI format that can be copied and pasted into an MD-CLI command with a CLI path as input. 
- 
json-instance-path Displays a YANG-modeled path format, based on RFC 6020 and RFC 7951, that describes the path to the modeled root, including all list names, list keys, and list key values. This path can be used with the pySROS libraries. For more information, see the 7450 ESS, 7750 SR, 7950 XRS, and VSR System Management Guide, "Python" chapter. 
 *[ex:/configure card 1 mda 2 network] A:admin@node-2# pwc cli-pathA:admin@cses-V93# pwc model-path Present Working Context: /nokia-conf:configure/card=1/mda=2/network *[ex:/configure card 1 mda 2 network] A:admin@cses-V93# pwc gnmi-path Present Working Context: /configure/card[slot-number=1]/mda[mda-slot=2]/network *[ex:/configure card 1 mda 2 network] A:admin@cses-V93# pwc cli-path Present Working Context: /configure card 1 mda 2 network *[ex:/configure card 1 mda 2 network] A:admin@cses-V93# pwc json-instance-path Present Working Context: /nokia-conf:configure/card[slot-number="1"]/mda[mda-slot="2"]/network
- 
 
- 
- 
back The back command can be used to go back one or more levels. If no parameter value is specified for the number of levels to go back, the default is one level. Using back at the top of the current command tree moves the context to the operational root level. If the number of levels specified is greater than the current depth, the context moves to the operational root. A closing brace (}) can also be used to go back one level. *[ex:/configure card 1 mda 2 network] A:admin@node-2# back *[ex:/configure card 1 mda 2] A:admin@node-2# back 2 *[ex:/configure] A:admin@node-2# back 5 *[ex:/] A:admin@node-2#
- 
top The top command moves the context to the top of the current command tree without exiting the mode. Use the top command instead of issuing the back command multiple times to move the context to the top of the command tree. *(ex)[/] A:admin@node-2# configure *(ex)[/configure] A:admin@node-2# card 1 *(ex)[/configure card 1] A:admin@node-2# mda 2 *(ex)[/configure card 1 mda 2] A:admin@node-2# network *(ex)[/configure card 1 mda 2 network] A:admin@node-2# top *(ex)[/configure] A:admin@node-2#
- 
exit The exit command moves the context to the previous context in the current command tree. If the previous context was up one level, the exit command functions similarly to the back command. Using exit all moves the context to the operational root. A slash (/) or Ctrl-Z can also be used instead of exit all. Using exit at the operational root has no effect. To log out of the system, the logout command must be used. *(ex)[/] A:admin@node-2# *(ex)[/] A:admin@node-2# configure card 1 mda 2 *(ex)[/configure card 1 mda 2] A:admin@node-2# network *(ex)[/configure card 1 mda 2 network] A:admin@node-2# exit all *(ex)[/] A:admin@node-2# configure card 1 mda 2 network *(ex)[/configure card 1 mda 2 network] A:admin@node-2# / *(ex)[/] A:admin@node-2#
Using the tree command
The tree command displays the command tree under the present working context, excluding the present working context element. Hierarchy is indicated with a pipe (|), and a "+-- " separator precedes each element. The tree output is in alphabetical order of elements.
[ex:/configure system security aaa remote-servers]
A:admin@node-2# tree
+-- apply-groups
+-- apply-groups-exclude
+-- ldap
|   +-- admin-state
|   +-- apply-groups
|   +-- apply-groups-exclude
|   +-- public-key-authentication
|   +-- route-preference
|   +-- server
|   |   +-- address
|   |   |   +-- apply-groups
|   |   |   +-- apply-groups-exclude
|   |   |   +-- port
|   |   +-- admin-state
|   |   +-- apply-groups
|   |   +-- apply-groups-exclude
|   |   +-- bind-authentication
|   |   |   +-- password
|   |   |   +-- root-dn
|   |   +-- search
|   |   |   +-- base-dn
|   |   +-- server-name
|   |   +-- tls-profile
|   +-- server-retry
|   +-- server-timeout
|   +-- use-default-template
---snip---Using the flat option
The flat option displays the command hierarchy under the present working context on one line, excluding the present working context element.
[/]
A:admin@node-2# tree flat
admin
admin clear
admin clear security
admin clear security lockout
admin clear security lockout all
admin clear security lockout user
admin clear security password-history
admin clear security password-history all
admin clear security password-history user
admin disconnect
admin disconnect address
admin disconnect op-table-bypass
admin disconnect session-id
admin disconnect session-type
admin disconnect username
admin reboot
admin reboot [card]
admin reboot now
admin redundancy
admin redundancy force-switchover
admin redundancy force-switchover now
admin redundancy synchronize
admin redundancy synchronize boot-environment
admin redundancy synchronize certificate
admin redundancy synchronize configuration
---snip---Using the detail option
The detail option displays all key and field values in the output on every line.
[/]
A:admin@node-2# tree detail
+-- admin
| +-- clear
| | +-- security
| | +-- lockout
| | | +-- all
| | | +-- user <string>
| | +-- password-history
| | +-- all
| | +-- user <string>
| +-- disconnect
| | +-- address <ipv4-address | ipv6-address>
| | +-- op-table-bypass <boolean>
| | +-- session-id <number>
| | +-- session-type <keyword>
| | +-- username <string>
| +-- reboot
| | +-- [card] <keyword>
| | +-- now
| +-- redundancy
| | +-- force-switchover
| | | +-- now
| | +-- synchronize
| | +-- boot-environment
| | +-- certificate
| | +-- configuration
---snip---The flat and detail options can be combined in any order.
[/]
A:admin@node-2# tree flat detail
admin
admin clear
admin clear security
admin clear security lockout
admin clear security lockout all
admin clear security lockout user <string>
admin clear security password-history
admin clear security password-history all
admin clear security password-history user <string>
admin disconnect
admin disconnect address <ipv4-address | ipv6-address>
admin disconnect op-table-bypass <boolean>
admin disconnect session-id <number>
admin disconnect session-type <keyword>
admin disconnect username <string>
admin reboot
admin reboot [card] <keyword>
admin reboot now
admin redundancy
admin redundancy force-switchover
admin redundancy force-switchover now
admin redundancy synchronize
admin redundancy synchronize boot-environment
admin redundancy synchronize certificate
admin redundancy synchronize configuration
---snip---Using the path-format option
The path-format option is an unnamed command option. This means it can be included with one of its values or omitted in favor of one of its values, which are as follows: model-path, gnmi-path, or json-instance-path.
The path-format option displays in alternative formats the MD-CLI items that are available on the router. The alternative formats may be used in a variety of applications and tools, including for gNMI streaming telemetry and Python programming.
The command outputs all available paths on the router. Not all the paths are available to be used in external applications but all are provided for reference.
[ex:/configure]
A:admin@node-2# tree model-path 
/nokia-conf:configure/aaa
/nokia-conf:configure/aaa/apply-groups
/nokia-conf:configure/aaa/apply-groups-exclude
/nokia-conf:configure/aaa/diameter
/nokia-conf:configure/aaa/diameter/node
/nokia-conf:configure/aaa/diameter/node/apply-groups
/nokia-conf:configure/aaa/diameter/node/apply-groups-exclude
/nokia-conf:configure/aaa/diameter/node/connection
/nokia-conf:configure/aaa/diameter/node/connection/ipv4
/nokia-conf:configure/aaa/diameter/node/connection/ipv4/allow-connections
/nokia-conf:configure/aaa/diameter/node/connection/ipv4/local-address
/nokia-conf:configure/aaa/diameter/node/connection/ipv6
/nokia-conf:configure/aaa/diameter/node/connection/ipv6/allow-connections
/nokia-conf:configure/aaa/diameter/node/connection/ipv6/local-address
/nokia-conf:configure/aaa/diameter/node/connection/timer
/nokia-conf:configure/aaa/diameter/node/description
/nokia-conf:configure/aaa/diameter/node/origin-realm[ex:/configure]
A:admin@node-2# tree gnmi-path 
/configure/aaa
/configure/aaa/apply-groups
/configure/aaa/apply-groups-exclude
/configure/aaa/diameter
/configure/aaa/diameter/node[origin-host]
/configure/aaa/diameter/node[origin-host]/apply-groups
/configure/aaa/diameter/node[origin-host]/apply-groups-exclude
/configure/aaa/diameter/node[origin-host]/connection
/configure/aaa/diameter/node[origin-host]/connection/ipv4
/configure/aaa/diameter/node[origin-host]/connection/ipv4/allow-connections
/configure/aaa/diameter/node[origin-host]/connection/ipv4/local-address
/configure/aaa/diameter/node[origin-host]/connection/ipv6
/configure/aaa/diameter/node[origin-host]/connection/ipv6/allow-connections
/configure/aaa/diameter/node[origin-host]/connection/ipv6/local-address
/configure/aaa/diameter/node[origin-host]/connection/timer
/configure/aaa/diameter/node[origin-host]/description
/configure/aaa/diameter/node[origin-host]/origin-realm[ex:/configure]
A:admin@node-2# tree json-instance-path 
/nokia-conf:configure/aaa
/nokia-conf:configure/aaa/apply-groups
/nokia-conf:configure/aaa/apply-groups-exclude
/nokia-conf:configure/aaa/diameter
/nokia-conf:configure/aaa/diameter/node[origin-host]
/nokia-conf:configure/aaa/diameter/node[origin-host]/apply-groups
/nokia-conf:configure/aaa/diameter/node[origin-host]/apply-groups-exclude
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection/ipv4
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection/ipv4/allow-connections
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection/ipv4/local-address
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection/ipv6
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection/ipv6/allow-connections
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection/ipv6/local-address
/nokia-conf:configure/aaa/diameter/node[origin-host]/connection/timer
/nokia-conf:configure/aaa/diameter/node[origin-host]/description
/nokia-conf:configure/aaa/diameter/node[origin-host]/origin-realmUsing control characters and editing keystrokes on the command line
| Command | Description | 
|---|---|
| / (Slash) | Return to the operational root (equivalent to exit all) if used without parameters. Navigate into context or set the value and remain in current context if used at the beginning of a line (equivalent to exit all, and then the command) | 
| } (Closing brace) | Go back one level | 
| Alt-B or Esc+B | Move back one word or to the beginning of the current word if the cursor is not at the start of the word | 
| Alt-D or Esc+D | Delete the remainder of the word | 
| Alt-F or Esc+F | Move forward one word | 
| Ctrl-Z | Return to operational root. If using Ctrl-Z after a command, return to the operational root after executing the command (equivalent to pressing Enter after the command and exit all after the command has executed). | 
| Ctrl-C | Stop the current command | 
| Ctrl-D | Delete the current character | 
| Ctrl-W | Delete the word up to the cursor | 
| Ctrl-H | Delete the current character and move the cursor left | 
| Ctrl-U | Delete text up to the cursor and preserve the character under the cursor | 
| Ctrl-K | Delete the text after the cursor, without preserving the character under the cursor | 
| Ctrl-A or Home | Move to the beginning of the line | 
| Ctrl-E or End | Move to the end of the line | 
| Ctrl-P or Up arrow | Display the previous command from the command history | 
| Ctrl-N or Down arrow | Display the next command from the command history | 
| Ctrl-R | Search the command history in reverse order | 
| Esc+. | Display the last element of the previous command | 
| Ctrl-B or Left arrow | Move the cursor one space to the left | 
| Ctrl-F or Right arrow | Move the cursor one space to the right | 
| Ctrl-I | Enter a tab | 
| Ctrl-J | Enter a new line | 
| Ctrl-M | Enter a carriage return | 
| Ctrl-L | Clear the screen | 
Displaying available commands using Tab
Variables, keywords, global commands, and configuration commands and units are separated by a blank line in the output, in the following order:
- 
values or units (mutually exclusive) 
- 
keywords 
- 
global commands 
- 
configuration commands 
Displaying commands using Tab
[ex:/configure log]
A:admin@node-2# Press Tab
 accounting-policy        app-route-notifications  apply-groups
 apply-groups-exclude     event-damping            event-handling
 event-trigger            file                     filter
 foo                      log-events               log-id
 route-preference         services-all-events      snmp-trap-group
 syslog                   throttle-rate
 back                     delete                   edit-config
 enable                   exec                     exit
 history                  info                     insert
 logout                   oam                      ping
 pwc                      pyexec                   ssh
 telnet                   top                      traceroute
 tree
 annotate                 commit                   compare
 copy                     discard                  rename
 update                   validate[ex:/configure log]
A:admin@node-2# event-damping Press Tab
 
 <event-damping>
 false
 true
 accounting-policy        app-route-notifications  apply-groups
 apply-groups-exclude     event-handling           event-trigger
 file                     filter                   log-events
 log-id                   route-preference         services-all-events
 snmp-trap-group          syslog                   throttle-rate
 delete                   insertThe ? help displays similar information but only displays global or configuration commands at the operational root or at the root of a command context.
Global commands displayed at the environment root context
[/environment]
A:admin@node-2# ?
 command-completion    + Enter the command-completion context
 console               + Enter the console context
 message-severity-     + Enter the message-severity-level context
  level
 more                  - Prompt to continue or stop when output text fills page
 progress-indicator    + Enter the progress-indicator context
 prompt                + Enter the prompt context
 time-display          - Time zone displayed before the prompt
 time-format           - Time format to display date and time
 Global commands:
 back                  - Move back one or more levels
 delete                - Delete an element
 edit-config           - Enter a candidate configuration mode
 enable                - Enable administrative mode
 exec                  - Execute commands from a file
 exit                  - Return to the previous context or to operational root
 history               - Show the command history
 info                  - Show the information under the present working context
 logout                - Exit the CLI session
 oam                   - Perform OAM tests
 ping                  - Ping an IP address or DNS name
 pwc                   - Show the present working context
 pyexec                - Execute a Python application
 ssh                   - SSH to an IP address or DNS name
 telnet                - Telnet to an IP address or DNS name
 top                   - Move to the top level of the context
 traceroute            - Show the route taken to an IP address or DNS name
 tree                  - Show the command tree under the present working contextGlobal commands available in the context
The global commands are not displayed in the environment prompt context, for example, although these commands are still available in the context.
[/environment prompt]
A:admin@node-2# ?
 context               - Show the current command context in the prompt
 newline               - Add a new line before every prompt line
 timestamp             - Show the timestamp before the first prompt line
 uncommitted-changes-  - Show an asterisk (*) when uncommitted changes exist
  indicator
[/environment prompt]
A:admin@node-2# info detail
    context true
    newline true
    timestamp false
    uncommitted-changes-indicator trueAvailable commands with mutually exclusive commands
When a command that is part of a choice of commands is entered at the MD-CLI command prompt, the other mutually exclusive commands are no longer available to be entered on the same prompt line. Other commands that are not associated with the particular choice commands are still available.
In the following example, if either the cir or fir command is entered, the police command is not available. The pir command is available regardless of which choice command is entered.
*[ex:/configure qos sap-ingress "ing-1" queue 1 rate]
A:admin@node-2# ?
 pir                   - Administrative PIR
 Choice: rate-cir-fir-or-police
 cir                  :- Administrative CIR
 fir                   - Administrative FIR
 police               :- Drop the traffic feeding into queue above the PIR rate
*[ex:/configure qos sap-ingress "ing-1" queue 1 rate]
A:admin@node-2# cir max Press Tab
 fir     pir
 deleteSimilarly, if the police command is entered, the cir and fir commands are unavailable on the same command prompt line.
*[ex:/configure qos sap-ingress "ing-1" queue 1 rate]
A:admin@node-2# police ?
 police - This element has no values
    Drop the traffic feeding into queue above the PIR rate
 pir                   - Administrative PIR
*[ex:/configure qos sap-ingress "ing-1" queue 1 rate]
A:admin@node-2# police Press Tab
 pir
 deleteUsing command completion
The MD-CLI supports both command abbreviation and command completion. When typing a command, Tab, Spacebar, or Enter invokes auto-completion. If the text entered is enough to match a specific command, auto-completion completes the command. If the text entered is not sufficient to identify a specific command, pressing Tab or Spacebar displays options in alphabetical order matching the text entered.
The environment command-completion command controls what keystrokes can trigger command completion. Each keystroke is independently controlled with its own Boolean value.
(ex)[/environment command-completion]
A:admin@node-2# info detail
    enter true
    space true
    tab true- 
configure por+Spacebar displays auto-completion results 
- 
configure port+Spacebar inserts a space and suppresses auto-completion results 
- 
configure por+Tab displays auto-completion results 
- 
configure port+Tab displays auto-completion results 
Variable parameter completion
Variable parameter completion works only with the Tab key. All configured variables from the candidate and running configuration datastores are displayed. Line wrapping may occur for variables with long names. Parameters are displayed in alphabetical or numerical order. The variable parameter name is always displayed as the first line.
In the following example, "interface-name" is the variable parameter name and "int-1" and "system" are configured names.
*[ex:/configure router "Base"]
A:admin@node-2# interface Press Tab 
 <interface-name>
 "int-1"
 "system"
*[ex:/configure router "Base"]
A:admin@node-2# interfaceCompletion for lists with a default keyword
Some list elements have a default keyword defined, such as the router command, where the default keyword is "Base". When the command completion parameters (Enter, Spacebar, and Tab) are at their default settings (true), and the initial input matches an element in the list and a unique command keyword, the matching keyword is completed instead of the variable.
For example, the router command has a default keyword defined as "Base". If router "bf" is created using the command configure router "bf" (with quotation marks), and there is an existing bfd command context, the variable completion is as follows.
Display for router+Spacebar+Tab
*[ex:/configure]
A:admin@node-2# router Press Tab
 <router-name>
 "Base"
 "bf"
 "management"
 aggregates             allow-icmp-redirect    allow-icmp6-redirect
 apply-groups           apply-groups-exclude   autonomous-system
 bfd                    bgp                    bier
 
---snip---Display for router bf+Tab
*[ex:/configure]
A:admin@node-2# router bfPress Tab
 "bf"
 bfd
Entering router bf+Enter
Entering router bf+Enter completes to router bfd and enters the router "Base" bfd context:
*[ex:/configure]
A:admin@node-2# router bfd Press Enter
*[ex:/configure router "Base" bfd]
A:admin@node-2#Entering router bf+Spacebar
Similarly, router bf+Spacebar completes to router bfd and enters the router "Base" bfd context when Enter is pressed:
*[ex:/configure]
A:admin@node-2# router bfd Press Spacebar+Enter
*[ex:/configure router "Base" bfd]
A:admin@node-2#Using quotation marks to specify a variable
To enter the context for router "bf", use quotation marks to specify the variable:
[ex:/configure]
A:admin@node-2# router "bf"
*[ex:/configure router "bf"]
A:admin@node-2#Command completion for enter set to false
If the command completion for enter is set to false, router bf+ Enter allows the match to router "bf". Similarly, when the command completion for space is false, router bf+Spacebar also matches to router "bf" instead of the bfd context
*(ex)[/environment command-completion]
A:admin@node-2# info detail
    enter true
    space true
    tab true
*(ex)[/environment command-completion]
A:admin@node-2# enter false
*(ex)[/environment command-completion]
A:admin@node-2# space false
*(ex)[/environment command-completion]
A:admin@node-2#
*(ex)[/]
A:admin@node-2# configure
*(ex)[/configure]
A:admin@node-2# router bf Press Enter 
*(ex)[/configure router "bf"]
A:admin@node-2# back
*(ex)[/configure]
A:admin@node-2# router bf Press Spacebar+Enter
*(ex)[/configure router "bf"]
A:admin@node-2#Completion for keyword-based leaf-lists
For keyword-based leaf-lists, command completion displays all possible values, not only those that are configured. When deleting values in a leaf-list, only the values that are currently configured are displayed.
In the following example, when defining the forwarding traffic classes, all keyword values are listed. When deleting the forwarding traffic classes, only the configured classes are displayed.
*[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# family ?
 family <value>
 family [<value>...] - 1..20 system-ordered values separated by spaces enclosed
                        by brackets
 <value>   - <keyword>
 <keyword> - (ipv4|vpn-ipv4|ipv6|mcast-ipv4|vpn-ipv6|l2-vpn|mvpn-ipv4|mdt-
              safi|ms-pw|flow-ipv4|route-target|mcast-vpn-ipv4|mvpn-ipv6|
              flow-ipv6|evpn|mcast-ipv6|label-ipv4|label-ipv6|bgp-ls|mcast-
              vpn-ipv6|sr-policy-ipv4|sr-policy-ipv6|flow-vpn-ipv4|flow-
              vpn-ipv6)
    Address family as the match condition
   *[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# family [ipv4 mcast-ipv4 mcast-vpn-ipv4 label-ipv4]
*[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# info
    family [ipv4 mcast-ipv4 mcast-vpn-ipv4 label-ipv4]
*[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# delete family Press Tab
 <family>
 ipv4
 mcast-ipv4
 mcast-vpn-ipv4
 label-ipv4
 *
Completion for Boolean elements
The explicit use of the keyword true for a Boolean element is optional. If neither true or false is entered, the keyword true is assumed.
(ex)[/environment]
A:admin@node-2# more ?
 more <boolean>
 <boolean> - ([true]|false)
 Default   - true
    Activate the pager when output is longer than a screenWhen Tab is used for command completion with Boolean elements, the values of false and true are displayed, along with the names of possible elements that can follow.
In the following example of the environment more command, the commands command-completion, console, message-severity-level, and so on, can be defined following the more command.
(ex)[/environment]
A:admin@node-2# more Press Tab
 <more>
 false
 true
 command-completion      console                 message-severity-level
 progress-indicator      prompt                  time-display
 time-format
 delete
Modifying the idle timeout value for CLI sessions
A single idle timeout applies to all CLI engines in a CLI session (classic and MD-CLI). The idle timeout can be modified to a value between 1 and 1440 minutes.
The following points apply:
- 
The idle timeout only affects new CLI sessions. Existing and current sessions retain the previous idle timeout. 
- 
The idle timeout can be disabled by setting the value to none. 
- 
The "Idle time" column in the show users display is reset after an action in either CLI engine. 
A warning message is displayed when a session reaches one-half the value of the idle timeout, and another message is displayed when the idle timeout expires and the user is logged out.
[/]
A:admin@node-2# show users
===============================================================================
User                             Type      Login time           Idle time
  Session ID   (Router instance)
               From
===============================================================================
                                 Console         --             0d 21:44:02 --
  6            (--)
               --
admin                            SSHv2     16FEB2021 20:42:15   0d 00:00:04 --
  12           (management)
               192.168.144.97
admin                            SSHv2     16FEB2021 19:49:45   0d 00:00:00 --
 #11           (management)
               192.168.144.97
-------------------------------------------------------------------------------
Number of users: 2
'#' indicates the current active session
===============================================================================Idle timeout interaction with the classic CLI
The idle timeout configured in the classic CLI affects all new sessions as well as the current session. However, the current session is only affected if the classic CLI engine is active when the idle timeout expires. Configuration changes via the MD-CLI or any other interface only affect new sessions that begin after the change.
Using the pager
The MD-CLI pager paginates command output one screenful at a time. It supports movement and searching in forward and backward directions.
The status line at the bottom of the screen displays the following information.
--(more)--(p%)--(lines b-e/t)--where
- p - indicates the position percentage in the output
- b - indicates the beginning line of the output on the screen
- e - indicates the ending line of the output on the screen
- t - indicates the total lines in the output
--(more)--(5%)--(lines 1-29/527)—If the command output is still being generated, a question mark ("?") is displayed after the total lines and a warning indicates that the search is incomplete. These indicators are removed when the command output completes.
--(more)--(0%)--(lines 1-29/49833?)--(warning: search will be incomplete)--The pager supports a high number of output lines. If the command output exceeds the pager memory, an asterisk (*) is displayed after the total lines and a warning indicates that the search is incomplete.
--(more)--(0%)--(lines 3578-3607/93151747*)--(warning: search will be incomplete)--The following table describes the general and movement commands available for use.
| Action | Command | 
|---|---|
| Show the help | h, H | 
| Exit the pager | q, Q, Ctrl-C, Ctrl-Z | 
| Move a line forward (n) | e, j, Ctrl-E, Ctrl-J, Ctrl-M, Ctrl-N, Down arrow, Enter | 
| Move a half screen forward (n) | d, Ctrl-D, Ctrl-I, Tab | 
| Move a screen forward (n) | f, Ctrl-F, Ctrl-V, Page down, Right arrow, Spacebar | 
| Move a line backward (n) | k, y, minus (-), Ctrl-8, Ctrl-H, Ctrl-K, Ctrl-P, Ctrl-Y, Backspace, Delete, Up arrow | 
| Move a half screen backward (n) | u, Ctrl-U | 
| Move a screen backward (n) | b, Ctrl-B, Left arrow, Page up | 
| Move to the beginning of the output | g, p, open angle bracket (<), Ctrl-A, Home | 
| Move to the end of the output | G, closed angle bracket ( >), End | 
| Jump to line (n) | g, G | 
The output can be searched by entering a search command followed by a string or regular expression at the bottom of the screen. The first match in the output is highlighted and underlined on the screen, and repeating the search displays the next match. Re-entering the search command displays the previous search so that it can be edited.
Searching with a string
The following string search matches any string containing "mda".
/mda
Searching with a regular expression
The following regular expression search matches the neighbor with the IP address that ends with 42 (neighbor "10.81.192.42").
/nei.*42See Using regular expressions for more information about using regular expressions. The regular expression is highlighted until it is valid. Highlighting occurs when delimiters such as () and [] are unmatched, or when an asterisk (*) or question mark (?) is entered without a preceding expression.
The following table describes the search commands available for use.
| Action | Command | 
|---|---|
| Forward search | forward slash (/) | 
| Backward search | question mark (?) | 
| Repeat previous forward search | n | 
| Repeat previous backward search | N | 
| Clear search highlighting | c, Ctrl-L, Esc+U | 
The following usage guidelines apply to the pager:
- the minimum supported terminal size is 80 characters wide by 24 lines long
- resizing the terminal when the pager is active is not supported
Using output modifiers
Output modifiers provide support for post-processing of CLI output. Output modifiers are specified using a vertical bar (|) character. The following points apply when using output modifiers:
- 
Output modifiers can be appended to any CLI command in any command context. 
- 
Output modifiers work across soft line breaks (visual lines) that are wrapped because of the terminal width; for example, using match or count. They do not work across hard line breaks (logical lines). 
- 
Modifiers can be combined in any order. No hard limit exists for the number of combinations. Output is processed linearly and there is little impact on the system performance except to the operator session that entered the modifier combination. 
Using | match options
The following options are supported for use with the pipe (|) match command:
- 
ignore-case This specifies to ignore case in pattern match. 
- 
invert-match This specifies to invert the pattern match selection. 
- 
max-count This specifies the maximum number of displayed matches. 
- 
post-lines This specifies the number of lines to display following the matched line. 
- 
pre-lines This specifies the number of lines to display preceding the matched line. 
The default pattern matching is a string match. If the required pattern to match includes a space, the pattern must be delimited by quotation marks ("). Regular expressions are delimited by apostrophes ('). See Using regular expressions for more information about using regular expressions.
The following example matches on the pattern autonomous-system in the tree detail under the configure router "Base" context, and starts the display with ten lines preceding the pattern match.
[ex:/configure router "Base"]
A:admin@node-2# tree detail | match autonomous-system pre-lines 10
|   |   +-- local-preference <number>
|   |   +-- policy <reference>
|   |   +-- summary-only <boolean>
|   |   +-- tunnel-group <number>
|   +-- apply-groups <reference>
|   +-- apply-groups-exclude <reference>
+-- allow-icmp-redirect <boolean>
+-- allow-icmp6-redirect <boolean>
+-- apply-groups <reference>
+-- apply-groups-exclude <reference>
+-- autonomous-system <number>
---snip---Using the | count option
The | count option displays the line count of the output.
[ex:/configure router "Base"]
A:admin@node-2# tree flat detail | match seamless-bfd
bfd seamless-bfd
bfd seamless-bfd peer <unicast-ipv4-address | global-unicast-ipv6-address>
bfd seamless-bfd peer <unicast-ipv4-address | global-unicast-ipv6-address> apply-groups <reference>
bfd seamless-bfd peer <unicast-ipv4-address | global-unicast-ipv6-address> apply-groups-exclude <reference>
bfd seamless-bfd peer <unicast-ipv4-address | global-unicast-ipv6-address> discriminator <number>
[ex:/configure router "Base"]
A:admin@node-2# tree flat detail | match seamless-bfd | count
Count: 5 linesUsing the | no-more option
The | no-more option displays the output with pagination disabled for the command. This option is similar to the environment more false setting that applies to all commands, where the entire output text is printed without page interruptions.
Using the | reverse-dns option
The | reverse-dns option performs a reverse DNS lookup on any IPv4 or IPv6 address in the input to the output modifier. The result of the lookup is inserted as the next line in the output on each line where an IP address is identified. If no match is found, no additional output is printed.
[/]
A:admin@node-2# ping 10.184.216.34 | reverse-dns
PING 10.184.216.34 56 data bytes
  (10.184.216.34) www.example.com
64 bytes from 10.184.216.34: icmp_seq=1 ttl=61 time=82.4ms.
64 bytes from 10.184.216.34: icmp_seq=2 ttl=61 time=82.5ms.
64 bytes from 10.184.216.34: icmp_seq=3 ttl=61 time=82.4ms.
64 bytes from 10.184.216.34: icmp_seq=4 ttl=61 time=82.3ms.
64 bytes from 10.184.216.34: icmp_seq=5 ttl=61 time=82.2ms.
---- 10.184.216.34 PING Statistics ----
  (10.184.216.34) www.example.com
5 packets transmitted, 5 packets received, 0.00% packet loss
round-trip min = 82.2ms, avg = 82.4ms, max = 82.5ms, stddev = 0.122msUsing the file redirect option
Use the > option to redirect output to a local or remote file. The > must be specified at the end of a command and cannot be combined with other appends or redirects. If the file exists, it is overwritten. If the file does not exist, it is created.
[ex:/configure router "Base"]
A:admin@node-2# info detail | match leak-export > ?
 [url] <string>
 <string> - <1..199 characters>
    Location to save the output
[ex:/configure router "Base"]
A:admin@node-2# info detail | match leak-export > cf3:leak-export.cfgUsing the file append option
Use the >> option to append output to a local file. The >> must be specified at the end of a command and cannot be combined with other appends or redirects. If the file exists, the output is appended. If the file does not exist, it is created.
[/state router "Base" bgp statistics]
A:admin@node-2# info detail | match bgp-paths >> ?
 [url] <string>
 <string> - <1..199 characters>
    Local location to append the output
[/state router "Base" bgp statistics]
A:admin@node-2# info detail | match bgp-paths >> cf3:bgp-paths
Using regular expressions
Regular expressions (REs) used by the MD-CLI engine are delimited by apostrophes ('); for example, '.*'. REs cannot be delimited by quotation marks ("); for example, ".*" because this indicates a string match.
MD-CLI REs are based on a subset of The Open Group Base Specifications Issue 7 and IEEE Std 1003.1-2008, 2016 Edition REs, as defined in chapter 9. MD-CLI REs only support Extended Regular Expression (ERE) notation as defined in section 9.4. Basic Regular Expression (BRE) notation as defined in section 9.3 is not supported.
In ERE notation, a backslash (\) before a special character is treated as a literal character. Backslashes are not supported before ( ) or { }, as they are in BREs to indicate a bracket expression or marked expression.
| Special character | Description | 
|---|---|
| . | Matches any single character | 
| * | Matches the preceding expression zero or more times | 
| ? | Matches the preceding expression zero or one time | 
| + | Matches the preceding expression one or more times | 
| [ ] | Matches a single character within the brackets | 
| [^] | Matches a single character not within the brackets | 
| ^ | Matches the starting position | 
| $ | Matches the ending position | 
| ( ) | Defines a marked subexpression | 
| {m,n} | Matches the preceding expression at least m and not more than n times | 
| {m} | Matches the preceding expression exactly m times | 
| {m, } | Matches the preceding expression at least m times | 
| { ,n} | Matches the preceding expression not more than n times | 
| | | Matches either expression preceding or following the | | 
| \ | Escapes and treats the following character as a match criterion | 
| - | Separates the start and end of a range | 
The following examples show the use of a bracket expression as a matching list expression.
Using no match expressions
The first output does not use any match expressions and therefore shows the entire output.
[/]
A:admin@node-2# show port
===============================================================================
Ports on Slot 1
===============================================================================
Port          Admin Link Port    Cfg  Oper LAG/ Port Port Port   C/QS/S/XFP/
Id            State      State   MTU  MTU  Bndl Mode Encp Type   MDIMDX
-------------------------------------------------------------------------------
1/1/1         Down  No   Ghost   8704 8704    - netw null xcme
1/1/2         Up    No   Ghost   1514 1514    - accs null xcme
1/1/3         Up    No   Ghost   1514 1514    - accs null xcme
1/1/4         Up    No   Ghost   1514 1514    - accs null xcme
1/1/5         Up    No   Ghost   1514 1514    - accs null xcme
1/1/6         Down  No   Ghost   8704 8704    - netw null xcme
1/1/7         Down  No   Ghost   8704 8704    - netw null xcme
1/1/8         Down  No   Ghost   8704 8704    - netw null xcme
1/1/9         Down  No   Ghost   8704 8704    - netw null xcme
1/1/10        Down  No   Ghost   8704 8704    - netw null xcme
1/1/11        Down  No   Ghost   8704 8704    - netw null xcme
1/1/12        Down  No   Ghost   8704 8704    - netw null xcme
1/2/1         Up    No   Ghost   8704 8704    - netw null xcme
1/2/2         Up    No   Ghost   1514 1514    - accs null xcme
1/2/3         Up    No   Ghost   1514 1514    - accs null xcme
1/2/4         Down  No   Ghost   8704 8704    - netw null xcme
(more)--(64%)--(lines 1-23/37)--Using matching list expression
In this matching list expression, a match is any single character in the bracket expression, which in this case is 1, 3, or 5.
[/]
A:admin@node-2# show port | match '1/1/[135]'
1/1/1         Down  No   Ghost   8704 8704    - netw null xcme
1/1/3         Up    No   Ghost   1514 1514    - accs null xcme
1/1/5         Up    No   Ghost   1514 1514    - accs null xcme
1/1/10        Down  No   Ghost   8704 8704    - netw null xcme
1/1/11        Down  No   Ghost   8704 8704    - netw null xcme
1/1/12        Down  No   Ghost   8704 8704    - netw null xcme
Using non-matching list expression
In this non-matching list expression, a match is any single character not in the bracket expression, that is, not 1, 2, or 4.
[/]
A:admin@node-2# show port | match '1/1/[^124]'
1/1/3         Up    No   Ghost   1514 1514    - accs null xcme
1/1/5         Up    No   Ghost   1514 1514    - accs null xcme
1/1/6         Down  No   Ghost   8704 8704    - netw null xcme
1/1/7         Down  No   Ghost   8704 8704    - netw null xcme
1/1/8         Down  No   Ghost   8704 8704    - netw null xcme
1/1/9         Down  No   Ghost   8704 8704    - netw null xcme
Using the range operator
The range operator (-) can be used in a matching or non-matching list expression.
[/]
A:admin@node-2# show port | match '1/1/[3-7]'
1/1/3         Up    No   Ghost   1514 1514    - accs null xcme
1/1/4         Up    No   Ghost   1514 1514    - accs null xcme
1/1/5         Up    No   Ghost   1514 1514    - accs null xcme
1/1/6         Down  No   Ghost   8704 8704    - netw null xcme
1/1/7         Down  No   Ghost   8704 8704    - netw null xcme
[/]
A:admin@node-2# show port | match '1/1/[^3-7]'
1/1/1         Down  No   Ghost   8704 8704    - netw null xcme
1/1/2         Up    No   Ghost   1514 1514    - accs null xcme
1/1/8         Down  No   Ghost   8704 8704    - netw null xcme
1/1/9         Down  No   Ghost   8704 8704    - netw null xcme
1/1/10        Down  No   Ghost   8704 8704    - netw null xcme
1/1/11        Down  No   Ghost   8704 8704    - netw null xcme
1/1/12        Down  No   Ghost   8704 8704    - netw null xcme
Using the alternation operator
The alternation operator (|) can be used with or without a bracket expression to match against two or more alternative expressions.
[/]
A:admin@node-2# show port | match '1/1/[2-5|7-9]'
1/1/2         Up    No   Ghost   1514 1514    - accs null xcme
1/1/3         Up    No   Ghost   1514 1514    - accs null xcme
1/1/4         Up    No   Ghost   1514 1514    - accs null xcme
1/1/5         Up    No   Ghost   1514 1514    - accs null xcme
1/1/7         Down  No   Ghost   8704 8704    - netw null xcme
1/1/8         Down  No   Ghost   8704 8704    - netw null xcme
1/1/9         Down  No   Ghost   8704 8704    - netw null xcme
Using no bracket expression
Without a bracket expression, an exact match is attempted against two or more alternative expressions.
*[ex:/configure card 1]
A:admin@node-2# info | match '10g|100g'
        mda-type imm4-10gb-xp-xfp
        mda-type cx2-100g-cfp
MD-CLI REs match on the output format of an element, as is shown in the configuration. For example, if the value of an element is shown in hexadecimal in info output, a decimal RE does not match the value.
Using anchoring special characters
MD-CLI REs are not implicitly anchored. This complete configuration is used to show how the ^ or $ anchoring special characters can be used to match in the following examples.
*[ex:/configure router "Base" bgp]
A:admin@node-2# info
    group "external" {
    }
    group "internal" {
    }
    neighbor "192.168.10.1" {
        group "external"
        keepalive 30
        peer-as 100
    }
    neighbor "192.168.10.2" {
        group "external"
        peer-as 100
        family {
            ipv4 true
        }
    }
Using the anchor character preceded by four spaces
This example uses the ^ anchor character to match on "group" preceded by four spaces at the beginning of the line.
*[ex:/configure router "Base" bgp]
A:admin@node-2# info | match '^    group' pre-lines 1
    group "external" {
    }
    group "internal" {
Using the anchor character preceded by eight spaces
This example uses the ^ anchor character to match on "group" preceded by eight spaces at the beginning of the line.
*[ex:/configure router "Base" bgp]
A:admin@node-2# info | match '^        group' pre-lines 1
    neighbor "192.168.10.1" {
        group "external"
    neighbor ""192.168.10.2" {
        group "external"
Using the compare command
In the following configuration example using the compare command, the | match option filters out those commands to be deleted (configuration statements beginning with minus (-)) and those to be added (configuration statements beginning with plus (+)).
*[ex:/configure log accounting-policy 5]
A:admin@node-2# /compare
+   admin-state enable
-   collection-interval 105
+   collection-interval 75
-   include-system-info true
+   include-system-info false
*[ex:/configure log accounting-policy 5]
A:admin@node-2# /compare | match '^-'
-   collection-interval 105
-   include-system-info true
Using the backslash
The backslash (\) is used to match the literal "+" character that denotes additions to the configuration seen in the compare command.
*[ex:/configure log accounting-policy 5]
A:admin@node-2# /compare | match '^\+'
+   admin-state enable
+   collection-interval 75
+   include-system-info false
A character class expression is expressed as a character class name enclosed within bracket colon ("[:" and ":]") delimiters.
Character class expressions must be enclosed within brackets. The expression ‛[[:digit:]]’ is treated as an RE containing the character class ‟digit”, while ‛[:digit:]’ is treated as an RE matching ‟:”, ‟d”, ‟i”, ‟g”, or ‟t”.
Collating symbols and equivalence classes are not supported in MD-CLI REs.
| Character class | Characters matched1 | Description | 
|---|---|---|
| [:alnum:] | ‛ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789’ | Alphanumeric characters | 
| [:alpha:] | ‛ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz’ | Alphabetic characters | 
| [:blank:] | ‛ \t’ | Spacebar and Tab | 
| [:cntrl:] | ‛\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20 \21\22\23\24\25\26\27\30 \31\32\33\34\35\36\37\177’ | Control characters | 
| [:digit:] | ‛0123456789’ | Digits | 
| [:graph:] | ‛ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~’ | Visible characters | 
| [:lower:] | ‛abcdefghijklmnopqrstuvwxyz’ | Lowercase letters | 
| [:print:] | ‛ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ’ | Visible characters and the space character | 
| [:punct:] | ‛!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~’ | Punctuation characters | 
| [:space:] | ‛\t\n\v\f\r ‛ | Whitespace (blank) characters | 
| [:upper:] | ‛ABCDEFGHIJKLMNOPQRSTUVWXYZ’ | Uppercase letters | 
| [:xdigit:] | ‛0123456789ABCDEFabcdef’ | Hexadecimal digits | 
Navigating contexts
Entering contexts
Configuring a container navigates into the context.
First container is log and next is log-events
All containers are marked with a "+".
[ex:/configure log]
A:admin@node-2# ?
 accounting-policy     + Enter the accounting-policy list instance
 app-route-            + Enter the app-route-notifications context
  notifications
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 event-damping         - Allow event damping algorithm to suppress QoS or
                         filter change events
 event-handling        + Enter the event-handling context
 event-trigger         + Enter the event-trigger context
 file                  + Enter the file list instance
 filter                + Enter the filter list instance
 log-events            + Enter the log-events context
 log-id                + Enter the log-id list instance
 route-preference      + Enter the route-preference context
 services-all-events   + Enter the services-all-events context
 snmp-trap-group       + Enter the snmp-trap-group list instance
 syslog                + Enter the syslog list instance
 throttle-rate         + Enter the throttle-rate context
[ex:/configure log]
A:admin@node-2# log-events
[ex:/configure log log-events]
A:admin@node-2#Same context entered on one line
Alternatively, the same context can be entered on one line:
(ex)[/]
A:admin@node-2# configure log log-events
(ex)[/configure log log-events]
A:admin@node-2#
Container lists are marked with a "+"
Container lists are also marked with a "+" and the context is entered by specifying the key for the list.
[ex:/configure log]
A:admin@node-2# ?
 accounting-policy     + Enter the accounting-policy list instance
 app-route-            + Enter the app-route-notifications context
  notifications
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 event-damping         - Allow event damping algorithm to suppress QoS or
                         filter change events
 event-handling        + Enter the event-handling context
 event-trigger         + Enter the event-trigger context
 file                  + Enter the file list instance
 filter                + Enter the filter list instance
 log-events            + Enter the log-events context
 log-id                + Enter the log-id list instance
 route-preference      + Enter the route-preference context
 services-all-events   + Enter the services-all-events context
 snmp-trap-group       + Enter the snmp-trap-group list instance
 syslog                + Enter the syslog list instance
 throttle-rate         + Enter the throttle-rate context[ex:/configure log]
A:admin@node-2# log-id ?
 [name] <string>
 <string> - <1..64 characters>
    Log ID[ex:/configure log]
A:admin@node-2# log-id "99"
[ex:/configure log log-id "99"]
A:admin@node-2#
Configuring a leaf element
Configuring a leaf element maintains the present working context if there is no explicit opening brace. Entering an explicit opening brace navigates into the specified context.
*[ex:/configure card 1 mda 2]
A:admin@node-2# clock-mode mode ?
 mode <keyword>
 <keyword> - (adaptive|differential)
    Clock mode
*[ex:/configure card 1 mda 2]
A:admin@node-2# clock-mode mode adaptive
*[ex:/configure card 1 mda 2]
A:admin@node-2# clock-mode { mode adaptive
*[ex:/configure card 1 mda 2 clock-mode]
A:admin@node-2#Configuring a container
Configuring a container navigates into the context.
[ex:/configure router "Base"]
A:admin@node-2# ?
 aggregates            + Enter the aggregates context
 allow-icmp-redirect   - Allow ICMP redirects on the management interface
 allow-icmp6-redirect  - Allow IPv6 ICMP redirects on the management interface
 apply-groups          - Apply a configuration group at this level
 apply-groups-exclude  - Exclude a configuration group at this level
 autonomous-system     - AS number advertised to peers for this router
 bfd                   + Enter the bfd context
 bgp                   + Enable the bgp context
---snip---
[ex:/configure router "Base"]
A:admin@node-2# bgp
[ex:/configure router "Base" bgp]
A:admin@node-2# ?
 add-paths             + Enable the add-paths context
 admin-state           - Administrative state of the BGP instance
 advertise-external    + Enter the advertise-external context
 advertise-inactive    - Advertise inactive BGP routes to peers
---snip---
[ex:/configure router "Base" bgp]
A:admin@node-2# add-paths
*[ex:/configure router "Base" bgp add-paths]
A:admin@node-2#
Configuring an empty container or a list where the only children are keys does not navigate into the context. These elements are displayed with aggregated braces with a space ({ }) on the same line. It is possible to enter the element name with an opening brace; however, no options are available in this context.
Configuring the list element sdp-include
For example, configuring the list element sdp-include with a key of ‟ref_group_name” does not change the existing context.
*[ex:/configure service pw-template "tt"]
A:admin@node-2# sdp-include ref_group_name
*[ex:/configure service pw-template "tt"]
A:admin@node-2# info
    sdp-include "ref_group_name" { }
*[ex:/configure service pw-template "tt"]
A:admin@node-2#
Exiting contexts
The back and top commands are used to navigate contexts, but it is also possible to use closing braces (}) to navigate.
The behavior of an explicit closing brace depends on the contents of the current command line. If the command line contains an explicit opening brace, the closing brace exits to the parent context of the opening brace.
In the following example with an opening brace on the command line, the closing brace exits VPRN 1, and then enters the context of VPRN 2.
(ex)[/]
A:admin@node-2# configure service vprn 1 { interface "intf1" description "vprn-if" } vprn 2
*(ex)[/configure service vprn "2"]
A:admin@node-2#
In the following example without an opening brace on the command line, the first closing brace exits interface "int1", and the second closing brace exits VPRN 1 and enters the VPRN 2 context.
*[ex:/configure service]
A:admin@node-2# vprn 1 interface "int1" description "vprn-if" } } vprn 2
*[ex:/configure service vprn "2"]
A:admin@node-2#
Executing commands from a file
The exec command executes commands from a file as if the user typed or pasted the input into the MD-CLI.
The exec command:
- 
errors if it detects an interactive input 
- 
terminates in the CLI engine in which it completes execution as follows: - 
If there are no commands that switch CLI engines, the CLI engine is always the one in which exec started. 
- 
If there are commands that switch CLI engines, exec ends in the last CLI engine that was entered. 
- 
//exec returns to the engine in which it was started. 
 
- 
- may error when used with file redirect (>) or output modifiers (|)
- 
terminates execution and displays an error message if an error occurs, leaving the session in the same context as when the error occurred 
The system executes the file as follows:
- 
disables pagination while the command is running 
- 
disables command completion while the command is running 
- 
suppresses the commands in the file from the command history 
Using commands that switch engines in an executable file
When using commands that switch between CLI engines within an executable file, the following commands are recommended:
- 
Use /!classic-cli to switch explicitly to the classic CLI engine and /!md-cli to switch explicitly to the MD-CLI engine, instead of // to toggle between engines. 
- 
Use exit all to get to a known starting point: the operational root of the classic CLI or the MD-CLI engine. 
- 
Include edit-config if the script needs to change the candidate configuration in the MD-CLI engine. Use quit-config after changes are committed in the script. Note:- 
An executable with edit-config may fail if other users have locked the configuration. 
- 
Issuing the quit-config command with changes in the candidate configuration while the session is in exclusive configuration mode fails the executable because of the ‟discard changes” prompt. 
 
- 
Using paths in commands
As described in Navigating hierarchy levels, the pwc command displays the present working context. Navigating around the MD-CLI hierarchy changes the present working context.
The MD-CLI path format, also known as cli-path, is displayed in the MD-CLI user prompt.
MD-CLI path format
[ex:/configure card 1 mda 1]
A:admin@node-2# pwc
Present Working Context:
  configure
  card 1
  mda 1For the following commands, an absolute or relative MD-CLI path can be specified to provide path qualified attributes:
- 
admin show configuration (see Displaying configuration with admin commands) 
- 
                    annotate (see Commenting configuration elements) 
- 
compare (see Using the compare outputs to copy and paste) 
- 
copy (see Using the copy command) 
- 
                    delete (see Deleting configuration elements) 
- 
discard (see Discarding configuration changes) 
- 
info (see Using the info command) 
- 
                    insert (see User-ordered lists) 
- 
rename (see Using the rename command) 
- 
                    replace (see Replacing configuration elements) 
- 
tree (see Using the tree command) 
The CLI path is accepted as an unnamed last parameter of the command. The information is displayed for the specified path.
Information displayed for a specified CLI path
[ex:/configure]
A:admin@node-2# info candidate detail units /configure system
 ## apply-groups
 ## apply-groups-exclude
 ## contact
    name "node-2"
 ## location
    icmp-vse false
    selective-fib false
 ## coordinates
 ## clli-code
    ospf-dynamic-hostnames false
---snip---A configuration lock from either implicit or explicit configuration mode is required to display paths for a configuration region.
The state branch does not have a lock and can always be specified.
state branch
[ex:/configure]
A:admin@node-2# info detail /state system
    oper-name "node-2"
    base-mac-address aa:bb:cc:00:00:00
    platform "7750 SR-12"
    chassis-topology standalone
    crypto-module-version "SRCM 3.1"
 ## fabric-speed
    temperature-status ok
    fp-generation-fp2 false
    fp-generation-fp3 false
    fp-generation-fp4 false
    fp-generation-fp5 false
    system-profile none
    active-cpm-slot "A"info command with a state path
The following example shows the use of the info command with a state path from operational mode.
[/]
A:admin@node-2# info /state system
    oper-name "node-2"
    base-mac-address aa:bb:cc:00:00:00
    platform "7750 SR-12"
    chassis-topology standalone
    crypto-module-version "SRCM 3.1"
    temperature-status ok
    fp-generation-fp2 false
    fp-generation-fp3 false
    fp-generation-fp4 false
    fp-generation-fp5 false
    system-profile none
    active-cpm-slot "A"Establishing a configuration lock
In the next example, to use the info command in a state context to a configuration region, a configuration lock must be established.
[/state system]
A:admin@node-2# info /configure system
                      ^^^^^^^^^
MINOR: MGMT_CORE #2203: Invalid element - currently not allowed
[/state system]
A:admin@node-2# edit-config read-only
INFO: CLI #2066: Entering read-only configuration mode
(ro)[/state system]
A:admin@node-2# info /configure system
    name "node-2"
    management-interface {
        configuration-mode mixed
        snmp {
            admin-state disable
        }
---snip---Supported commands with a CLI path parameter
(ex)[/state router "Base" bgp]
A:admin@node-2# info /state router bgp statistics routes-per-family ipv4
    remote-routes 45
    remote-active-routes 6
    backup-routes 0
*(ex)[/state router "Base" bgp]
A:admin@node-2# compare /configure system
-   name "test1"
+   name "test"
(ex)[/configure router "Base" bgp]
A:admin@node-2# discard /configure system
(ex)[/configure router "Base"]
A:admin@node-2# tree bgp group "mesh" add-paths ipv4
+-- receive
+-- send
[/]
A:admin@node-2# admin show configuration /configure router isis interface "system"
    passive true
(ex)[/configure policy-options]
A:admin@node-2# copy policy-statement "mytest" to /configure policy-options policy-statement "my_new_policy"
(ex)[/configure router "Base" bgp]
A:admin@node-2# rename /configure policy-options policy-statement "mytest" to "another_new_policy" 
Absolute path
An absolute CLI path is specified using the slash (/) as the MD-CLI tree structure from the root.
CLI path references a section of the MD-CLI tree under the indicated context
/configure card 1 mda 1CLI path references a specific leaf in the tree
/state system oper-nameRelative path
A relative CLI path specifies the MD-CLI tree structure from the present working context.
In the following example, the two info commands display the same information. The first command usage is an absolute path reference and the next usage is a relative path from the present working context (pwc).
[ex:/configure router "Base" bgp]
A:admin@node-2# pwc
Present Working Context:
  configure
  router "Base"
  bgp
[ex:/configure router "Base" bgp]
A:admin@node-2# info /configure router "Base" bgp group "grp1"
[ex:/configure router "Base" bgp]
A:admin@node-2# info group "grp1"Using expressions in commands
Several commands accept a path. For these commands, use expressions to specify multiple list keys in one command instead of entering multiple commands. For example, expressions can be used with the info command to display configuration or state information, and in configuration statements to enter parameter values. The following tables lists the expressions that can be used with each command.
| Command | Wildcard | Range | Regular expression | 
|---|---|---|---|
| admin show configuration | ✔ | ✔ | ✔ | 
| annotate | |||
| compare | |||
| copy | |||
| delete | ✔ | ✔ | ✔ | 
| discard | ✔ | ✔ | ✔ | 
| info | ✔ | ✔ | ✔ | 
| insert | ✔ | ✔ | ✔ | 
| rename | |||
| replace | ✔ | 
The wildcard asterisk (*) character can be entered to specify all list keys, for example info port * or configure port * admin-state enable.
To specify a range of numbers that is expanded sequentially into list keys, enter a numerical range enclosed in brackets ([]). Ranges entered with numbers separated by two periods (..) are incremented by 1 when expanded, for example port 1/1/[1..5]. A comma (,) can be used to enter multiple numbers or ranges.
The following table lists some example ranges and how they are expanded. Numbers are processed in the order they are entered; for example, a range of [3,6] expands to 3 and 6, and a range of [6,3] expands to 6 and 3. Ranges can be at any place in a string, for example vprn[1..3].
| Range | Expansion | 
|---|---|
| [1..5] | 1 2 3 4 5 | 
| [3,6] | 3 6 | 
| [6,3] | 6 3 | 
| [1..5,9] | 1 2 3 4 5 9 | 
| [1..3,6,8..10] | 1 2 3 6 8 9 10 | 
A range can have a backreference to a previous range in the same command line. The reference has the form [$n]
where n is a single digit from 0 to 9 and 0 is the first match.
For example:
- configure service vprn [1..5] router-id 10.20.[$0].1 expands
                    to:- configure service vprn 1 router-id 10.201.1.1
- configure service vprn 2 router-id 10.201.2.1
- configure service vprn 3 router-id 10.201.3.1
- configure service vprn 4 router-id 10.201.4.1
- configure service vprn 5 router-id 10.201.5.1
 
- configure router interface int[1..4] ipv6 address 2001:db8:[$0]:[1..10]::1
                    prefix-length 64 expands to:- four interfaces named int1, int2, int3, int4, each with 10 IPv6 addresses
 
To specify a set of strings that is expanded sequentially into list keys, enter an alphabetical sequence enclosed in brackets ([]). Strings must be separated by a comma (,), and enclosed in quotes (“) if they contain spaces. For example, configure router interface [one,“second int”,three] specifies interfaces named “one”, “second int”, and “three”.
To specify a matching condition for list keys, enter a regular expression enclosed in apostrophes (‘). See Using regular expressions for more information. For example, if there are three interfaces named “OLD1”, “OLD2”, and “OLD3”, delete router interface 'OLD.*' expands to:
- 
                delete router interface OLD1 
- 
                delete router interface OLD2 
- 
                delete router interface OLD3 
Using the command history
The MD-CLI command history records all commands executed exactly as they were entered after Enter is pressed. The history can be shown with the history command and navigated to display each command in the history. It can also be accessed, and commands can be edited, using recall, substitution, display, and backward search.
configure system management-interface cli md-cli environment history sizeAlternatively, users can set the value of the environment history size command in the per-session environment. A size of 0 disables the history.
| Action | Command | 
|---|---|
| Show the command history | history | 
| Show all commands in the history | history all | 
| Show the commands in the history | history commands-only | 
| Show the help | !? | 
| Move forward | Ctrl-N, Down arrow | 
| Move backward | Ctrl-P, Up arrow | 
The history is context aware so that it displays and accesses operational mode commands and commands entered in a configuration mode in each region separately. For example, commands entered in a configuration mode are not available in the operational mode history. The following table describes the availability of commands in the history.
| Mode | Command History | 
|---|---|
| Operational | Operational commands state commands | 
| configure bof or edit-config bof | Operational commands state commands Configuration mode commands bof region commands | 
| configure or edit-config | Operational commands state commands Configuration mode commands configure region commands | 
| configure debug or edit-config debug | Operational commands state commands Configuration mode commands debug region commands | 
| configure li or edit-config li | Operational mode commands state commands Configuration mode commands li region commands | 
Show the context-aware history
The history command output in this example shows configuration mode and configuration commands in the first output but does not in the second output in operational mode.
[ex:/configure router "Base" interface "NEW INTERFACE"]
A:admin@node-2# history
     1 10:30 show version
     2 10:30 ping 192.168.0.10 count 1
     3 10:30 info state system bootup last-boot-config-version
     4 10:31 configure exclusive
     5 10:31 router interface "NEW INTERFACE"
     6 10:31 commit
     7 10:31 history
[ex:/configure router "Base" interface "NEW INTERFACE"]
A:admin@node-2# exit all
[/]
A:admin@node-2# history
     1 10:30 show version
     2 10:30 ping 192.168.0.10 count 1
     3 10:30 info state system bootup last-boot-config-version
     4 10:31 configure exclusive
     7 10:31 history
     8 10:31 exit all
     9 10:32 historyShow all commands in the history
The history all command shows all commands in the history, regardless of the current mode. This example shows configuration mode and configuration commands in operational mode.
[/]
A:admin@node-2# history all
     1 10:30 show version
     2 10:30 ping 192.168.0.10 count 1
     3 10:30 info state system bootup last-boot-config-version
     4 10:31 configure exclusive
     5 10:31 router interface "NEW INTERFACE"
     6 10:31 commit
     7 10:31 history
     8 10:31 exit all
     9 10:32 history allShow commands in the history
To show the history without the entry numbers and execution times for copying and pasting, use the history commands-only command.
[/]
A:admin@node-2# history commands-only
show version
ping 192.168.0.10 count 1
info state system bootup last-boot-config-version
configure exclusive
history
exit all
history commands-onlyUsers can access the history for execution or command editing using several methods. To disable history recall, substitution, display, and backward search, set the following command in the global environment for all users:
configure system management-interface cli md-cli environment history recall falseAlternatively, users can set the environment history recall false command in the per-session environment.
| Action | Command | 
|---|---|
| Recall and execute by entry number | !number [element...] | 
| Recall and execute by string search | !string [element...] | 
| Recall and execute previous command | !! [element...] | 
| Substitute last element | !$ | 
| Display entry number | !number:p | 
| Display entry with string search | !string:p | 
| Display previous command | !!:p | 
| Display last element | Esc+. | 
| Backward search | Ctrl-R | 
| Exit search | Ctrl-C | 
Recall and execute the history by entering ! (exclamation point) followed by an entry number, a string search, ! for the previous command, or $ to substitute the last element that was entered in the previous command. The following history is used at the beginning of each of the following examples.
[/]
A:admin@node-2# history
     1 10:30 show version
     2 10:30 ping 192.168.0.10 count 1
Recall by entry number
[/]
A:admin@node-2# !2
[/]
A:admin@node-2# ping 192.168.0.10 count 1
PING 192.168.0.10 56 data bytes
64 bytes from 192.168.0.10: icmp_seq=1 ttl=121 time=1.58ms.
---- 192.168.0.10 PING Statistics ----
1 packet transmitted, 1 packet received, 0.00% packet loss
round-trip min = 1.58ms, avg = 1.58ms, max = 1.58ms, stddev = 0.000msRecall by search string
[/]
A:admin@node-2# !192
[/]
A:admin@node-2# ping 192.168.0.10 count 1
PING 192.168.0.10 56 data bytes
64 bytes from 192.168.0.10: icmp_seq=1 ttl=121 time=1.39ms.
---- 192.168.0.10 PING Statistics ----
1 packet transmitted, 1 packet received, 0.00% packet loss
round-trip min = 1.39ms, avg = 1.39ms, max = 1.39ms, stddev = 0.000ms
[/]
A:admin@node-2# !ping
[/]
A:admin@node-2# ping 192.168.0.10 count 1
PING 192.168.0.10 56 data bytes
64 bytes from 192.168.0.10: icmp_seq=1 ttl=121 time=1.27ms.
---- 192.168.0.10 PING Statistics ----
1 packet transmitted, 1 packet received, 0.00% packet loss
round-trip min = 1.27ms, avg = 1.27ms, max = 1.27ms, stddev = 0.000msRecall previous command
[/]
A:admin@node-2# !!
[/]
A:admin@node-2# ping 192.168.0.10 count 1
PING 192.168.0.10 56 data bytes
64 bytes from 192.168.0.10: icmp_seq=1 ttl=121 time=1.29ms.
---- 192.168.0.10 PING Statistics ----
1 packet transmitted, 1 packet received, 0.00% packet loss
round-trip min = 1.29ms, avg = 1.29ms, max = 1.29ms, stddev = 0.000ms
Substitute previous element
[/]
A:admin@node-2# ping 192.168.0.10
PING 192.168.0.10 56 data bytes
64 bytes from 192.168.0.10: icmp_seq=1 ttl=114 time=120ms.
64 bytes from 192.168.0.10: icmp_seq=2 ttl=114 time=120ms.
64 bytes from 192.168.0.10: icmp_seq=3 ttl=114 time=120ms.
64 bytes from 192.168.0.10: icmp_seq=4 ttl=114 time=120ms.
64 bytes from 192.168.0.10: icmp_seq=5 ttl=114 time=120ms.
---- 192.168.0.10 PING Statistics ----
5 packets transmitted, 5 packets received, 0.00% packet loss
round-trip min = 120ms, avg = 120ms, max = 120ms, stddev = 0.091ms
[/]
A:admin@node-2# traceroute !$
[/]
A:admin@node-2# traceroute 192.168.0.10
traceroute to 135.92.55.3, 30 hops max, 40 byte packets
  1  10.0.0.1 (10.0.0.1)    0.948 ms  0.754 ms  0.825 ms
  2  192.168.0.10 (192.168.0.10)    1.14 ms  1.08 ms  9.92 ms
Recall and enter additional elements
Additional elements can be entered after recalled commands to add to the command line. ? help and Tab command completion are supported after recalled commands. In this example, the previous ping command is recalled and size 1500 is added.
[/]
A:admin@cses-V93# !ping size 1500 
[/]
A:admin@node-2# ping 192.168.0.10 count 1 size 1500
PING 192.168.0.10 1500 data bytes
1508 bytes from 192.168.0.10: icmp_seq=1 ttl=63 time=3.30ms.
---- 135.92.55.3 PING Statistics ----
1 packet transmitted, 1 packet received, 0.00% packet loss
round-trip min = 3.30ms, avg = 3.30ms, max = 3.30ms, stddev = 0.000msThe history can be displayed to edit the command before execution by entering ! (exclamation mark) followed by an entry number, a string search, or ! for the previous command followed by :p. Esc+. substitutes the last element that was entered in the previous command. The following history is used at the beginning of each of these examples, and the ☐ character indicates the cursor position after the command is displayed.
[/]
A:admin@node-2# history
     1 10:30 show version
     2 10:30 ping 192.168.0.10 count 1Display entry number
[/]
A:admin@node-2# !2:p
[/]
A:admin@node-2# ping 192.168.0.10 count 1☐Display entry with string search
[/]
A:admin@node-2# !192:p
[/]
A:admin@node-2# ping 192.168.0.10 count 1☐
[/]
A:admin@node-2# !ping:p
[/]
A:admin@node-2# ping 192.168.0.10 count 1☐Display previous command
[/]
A:admin@node-2# !!:p
[/]
A:admin@node-2# ping 192.168.0.10 count 1☐Display last element
[/]
A:admin@node-2# traceroute 192.168.0.10☐  Esc+. was entered and "192.168.0.10" is displayedThe history can be searched backward interactively with a string search when Ctrl-R is entered. Additional Ctrl-R keystrokes search backward again, and (wrapped) is displayed when the search wraps. Pressing Enter exits search and executes the command, and Ctrl-C exits search without execution. The following history is used at the beginning of the following example.
[/]
A:admin@node-2# history
     1 10:30 show version
     2 10:30 ping 192.168.0.10 count 1Backward search
[/]
History search '':  Entering Ctrl-R displays the search prompt 
[/]
History search 'pi': ping 192.168.0.10 count 1  Entering "pi" displays the first match
[/]
History search 'pi' (wrapped): ping 192.168.0.10 count 1  Entering Ctrl-R again indicates the search wrapped
[/]
A:admin@node-2# ping 192.168.0.10 count 1  Enter exits search and executes the command
PING 192.168.0.10 56 data bytes
64 bytes from 192.168.0.10: icmp_seq=1 ttl=121 time=1.29ms.
---- 192.168.0.10 PING Statistics ----
1 packet transmitted, 1 packet received, 0.00% packet loss
round-trip min = 1.29ms, avg = 1.29ms, max = 1.29ms, stddev = 0.000ms