General and operational commands

The following table defines general and operational commands that can be entered at any point in the CLI.

Table 1. General and operational commands

Command

Description

Tab

Auto-completes a command

/

Moves to the root; can also be used to reset the context to the root for a specific command (for example: info from state /)

?

Displays context-based help

back

Returns to the context before executing the last command

baseline <argument>

Arguments:

  • check - check baseline update for current candidates

  • diff - show baseline configuration changes

  • update - update baseline for current candidate

bash

Opens a bash session

bash <command>

Executes a command without entering a bash session

cls

Clears the screen

diff [flat]

Compares the current candidate against the running configuration. Specifying flat provides a copy/paste format showing inserts and deletes. Global arguments include:

  • baseline - configuration candidate baseline

  • candidate - configuration candidate

  • checkpoint - configuration checkpoint

  • factory - factory configuration

  • file - file with configuration stored in .json format

  • from - source datastore to compare with

  • rescue - rescue configuration

  • running - running datastore

  • startup - startup configuration

If arguments are not used, this command must be used in candidate mode.

echo

Echoes text back to a session

enter

Switches to a different mode

enter candidate

Enters the shared candidate mode. Shared candidate mode is the default.

enter candidate exclusive

Enters the exclusive candidate mode

To switch between shared and exclusive, you must switch to a different datastore (for example. running).

enter candidate exclusive name <name>

Enters the exclusive mode for a named candidate

enter candidate name <name>

Enters the shared candidate mode for a named shared candidate

enter candidate private

Enters the candidate private mode

enter candidate private name <name>

Enters the candidate private mode for a named candidate

enter running

Enters the running mode (default)

enter show

Enters the show mode (used with show CLI plug-ins)

enter state

Enters the state mode (all configuration and operational states)

environment

Configures and displays environment variables

environment alias

Creates or overwrites an alias

environment bottom-toolbar

Changes the text displayed in the bottom toolbar

environment cli-engine type

Sets cli engine type for interactive logins:

  • basic

  • advanced

environment complete-on-space

Triggers auto-completion when a space is typed (default is to explicitly require a <TAB>)

environment delete

Resets and removes environment settings

environment key-completer-limit <limit>

Number of keys limited in auto-completion

environment load

Loads the environment settings from a file:

  • file (path of the configuration file)

  • home (use ~/.srlinuxrc configuration file)

environment output-format

Allows the default output format to change between text and JSON

environment prompt

Changes the prompt displayed before every input line

environment save

Saves the current environment

environment save home

Saves the current environment to the user home directory

environment save file <file>

Saves the current environment to a specific file

environment show

Shows the currently active environment settings

exit

Exits to a previous context

exit to <ancestor>

Exits to a specific ancestor of the current context

exit all

Exits to the root

filter

Filters output for show and info commands.

Usage: filter [<node>] [depth <value>] [fields <value>] [keys-only] [non-zero]

  • node - Positional node to filter on

  • depth - Filter out sub-nodes that are more than n levels deeper

  • fields - Fields to include

  • keys-only - Hide all fields

  • non-zero - Show only non-zero values (numeric values only)

file cat

The file commands allow you to interact with files and directories on the system. These commands are passed through to the Linux binaries that perform file actions, for example cat and cp. The file commands are supported in candidate, running, and state modes.

file cat displays files contents

Usage: cat <path (1-255 times)> [-v] [-T] [-t] [-s] [-n] [-E] [-e] [-A] [--version]

  • path - Specifies the path to a file or directory
  • -v - Verbose, explains what is being done
  • -T - Shows tabs, displaying TAB characters as ^I
  • -t - Equivalent to -vT
  • -s - Suppresses repeated empty output lines
  • -n - Numbers all output lines
  • -E - Displays $ at the end of each line
  • -e - Equivalent to -vE
  • -A - Shows all, equivalent to -vET
  • --version - Outputs version information and exits

file cd

Changes working directory

Usage: cd [<path>]

  • path - Specifies the path to a directory

file cp

Copies files and directories

Usage: cp <path (2 times)> [-a] [-f] [-i] [-l] [-n] [-r] [-p] [-R] [-s] [-u] [--version] [-v]

  • path - Specifies the path to a file or directory
  • -a - Specifies archive mode, preserving file ownership, permissions, and timestamps
  • -f - If an existing destination file cannot be opened, removes it and tries again (this option is ignored when the -n option is also used)
  • -i - Interactively prompts before overwrite (overrides a previous -n option)
  • -l - Hard links files instead of copying
  • -n - Does not overwrite an existing file (overrides a previous -i option)
  • -r - Copies directories recursively
  • -p - Preserves mode, ownership, and timestamps
  • -R - Copies directories recursively (alias of -r)
  • -s - Makes symbolic links instead of copying
  • -u - Copies only when the source file is newer than the destination or when the destination is missing
  • --version - Outputs version information and exits
  • -v - Verbose, explains what is being done

file ls

Lists directory contents

Usage: ls [<path (0-255 times)>] [-a] [-A] [-C] [--color <always|auto|never>] [-d] [-F] [-h] [-i] [-l] [-r] [-R] [-s] [-S] [--time-style <long-iso|full-iso|iso|locale>] [-t] [-u] [-U] [-v] [-x] [-X] [-1] [--version]

  • path - Specifies the path to a file or directory
  • -a - Lists all, including entries starting with .
  • -A - List almost all, excluding implied . and ..
  • -C - Lists entries by columns
  • --color - Colorizes the output
  • -d - Lists directories themselves, not their contents
  • -F - Classifies, appending indicators (one of */=>@|) to entries
  • -h - Human readable, with -l or -s, prints human readable sizes (for example, 1K, 234M, 2G)
  • -i - Inode, prints the index number of each file
  • -l - Uses a long listing format
  • -r - Reverses order while sorting
  • -R - Lists subdirectories recursively
  • -s - Prints the allocated size of each file, in blocks
  • -S - Sorts by file size, largest first
  • --time-style - With -l, shows times using a specific style
  • -t - Sorts by modification time, newest first
  • -u - With -lt, sorts by, and shows access time; with -l shows access time and sorts by name; otherwise, sorts by access time, newest first
  • -U - Does not sort; lists entries in directory order
  • -v - Verbose, explains what is being done
  • -x - Lists entries by lines instead of by columns
  • -X - Sorts alphabetically by entry extension
  • -1 - Lists one file per line
  • --version - Outputs version information and exits

file md5sum

Calculates and verifies checksums.

Usage: md5sum [<path (0-255 times)>] [-c] [--ignore-missing] [--quiet] [--status] [--version]

  • -c - Reads checksums from the files and checks them
  • --ignore-missing - Does not fail or report the status for missing files
  • --quiet - Does not print OK for each successfully verified file
  • --status - Does not output anything, status code shows success
  • --version - Outputs version information and exits

file mkdir

Creates directories.

Usage: mkdir <path (1-255 times)> [-m <value>] [-p] [--version] [-v]

  • path - Specifies the path to a file or directory
  • -m - Sets the file mode (as in chmod), not a=rwx - umask
  • -p - No error if existing, makes parent directories as needed
  • --version - Outputs version information and exits
  • -v - Verbose, explains what is being done

file mv

Moves or renames files and directories

Usage: mv <path (2 times)> [-f] [-i] [-n] [-u] [--version] [-v]

  • path - Specifies the path to a file or directory
  • -f - Force, does not prompt before overwriting
  • -i - Interactive, prompts before overwrite
  • -n - No clobber, does not overwrite an existing file if you specify more than one of -i, -f, -n, only the final one takes effect
  • -u - Update, moves only when the source is newer than the destination or when the destination is missing
  • --version - Outputs version information and exits
  • -v - Verbose, explains what is being done

file pwd

Prints the working directory

Usage: pwd [<path>] [--version]

  • path - Specifies the path to a file or directory
  • --version - Outputs version information and exits

file rm

Removes files or directories

Usage: rm <path (1-255 times)> [-f] [-i] [-I] [-r] [-R] [-d] [--version] [-v]

  • path - Specifies the path to a file or directory
  • -f - Force, ignores nonexistent files and arguments, never prompts before removal

  • -i - Interactive, prompts before every removal
  • -I - Interactive, prompts once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes
  • -r - Removes directories and their contents recursively
  • -R - Removes directories and their contents recursively (alias of -r)
  • -d - Directories, removes empty directories
  • --version - Outputs version information and exits
  • -v - Verbose, explains what is being done

file touch

Changes file timestamps

Usage: touch <path (1-255 times)> [-a] [-c] [-d <value>] [-m] [-r <value>] [-t <value> ] [--version]

-a - Changes only the access time

-c - Does not create any files

-d - Parses this string and uses it instead of the current time

-m - Changes only the modification time

-r - Uses this file's times instead of the current time

-t - Uses [[CC]YY]MMDDhhmm[.ss] instead of the current time

--version - Outputs version information and exit

help

Displays mode-related help

history

Displays the command history list with line numbers

history hot

Displays the top 5 most frequently used commands

history clear

Clears the history

info [path]

Shows the value of all nodes and fields under the current context; optionally made more specific by a path

info depth <n>

Filters out sub-nodes that are deeper than the specified depth

info detail

Shows also default values for unset fields

info flat

Shows each node or field as a single line

info use-proto-json

Shows the output as the JSON used for the protobuf messages

info from <mode>

Executes the info command from within the specified mode (either candidate, running, or state). The current context can be retrieved without a from argument.

list

Show the keys of all nodes under the current context

monitor [path]

Monitors state changes within the current context; optionally made more specific by a path

monitor recursive [path]

Includes children when monitoring

monitor sample

Uses sampling instead of on-change monitoring (interval in seconds)

ping

Sends IPv4 ICMPv4 echo requests to network hosts.

Usage: ping <destination> [-I <value>] [-M <value>] [-Q <value>] [-c <value>] [-i <value>] [-s <value>] [-t <value>] [network-instance <value>]

  • -I - Source interface/IP

  • -M - Path MTU discovery strategy

  • -M- pmtudisc_options - sets df-bit set

  • -Q - tos

  • -c - Number of ping requests

  • -i - Wait interval in seconds between each packet

  • -s - Packet size

  • -t - TTL (Time-To-Live)

ping6

Sends IPv6 ICMPv6 echo requests to network hosts.

Usage: ping6 <destination> [-I <value>] [-M <value>] [-Q <value>] [-c <value>] [-i <value>] [-s <value>] [-t <value>] [network-instance <value>]

  • -I - Source interface/IP

  • -M - Path MTU discovery strategy

  • -M- pmtudisc_options - sets df-bit set

  • -Q - tos

  • -c - Number of ping requests

  • -i - Wait interval seconds between each packet

  • -s - Packet size

  • -t - TTL (Time-To-Live)

pwc

Prints the current working context

quit

Closes the CLI session

save

Saves the current datastore to the specified file in JSON format.

Usage: save [detail] file <value> [from <running|state>] [text]

  • detail - Additionally saves the default values for unset fields

  • file - Output filename

  • from - Datastore used to retrieve data from

  • text - Use CLI (text) format instead of JSON

show

Displays plug-in style show commands; see Pre-defined show reports.

source <file>

Executes a set of commands from a file

tech-support

Generates a technical support file.

Usage: tech-support [ignore-host-keys <value>] [max-time <value>] [network-instance <value>] [no-core] [scp-to <value>]

  • ignore-host-keys - Skip security verification of remote SSH server key

  • max-time - Maximum time

  • network-instance - Network-instance for scp command

  • no-core - Skip inclusion of core files

  • scp-to - scp location, for example, user@server-ip:/tmp/

tools

Executes a tool command

traceroute

Prints the route packets trace to network host

Usage: traceroute <destination>

traceroute6

Prints the route IPv6 packets trace to network host

Usage: traceroute6 <destination>

tcptraceroute

tcptraceroute compatible wrapper for traceroute

Usage: tcptraceroute <destination>

tree [path]

Shows the tree structure in the current context; optionally made more specific with a path

tree flat

Shows each structure on a single line

tree from [mode]

Retrieves the tree from the current context in another mode

watch

Execute a program periodically

Within candidate mode only, the following apply

!!

Appends a line to the annotation of the current node

!!!

Replaces the annotation of the current node

commit now

Applies the changes, exits candidate mode, and enters running mode

commit stay

Applies the changes and then remains in candidate mode.

Permitted additional arguments: commit stay [save] [comment] [confirmed]

commit save

Applies the changes and then remains in candidate mode.

Permitted additional arguments: commit [stay] [checkpoint] save [confirmed] [comment]

commit checkpoint

Causes an automatic checkpoint after the commit succeeds.

Permitted additional arguments: commit [stay] [now] checkpoint [save] [confirmed]

commit validate

Verifies that a propose configuration change passes a management server validation

commit comment <comment>

Used with other arguments (except validate) to add a user comment where comment is a quoted string, 1-255 characters.

Permitted additional arguments: commit [stay] [save] [checkpoint] [confirmed] comment

commit confirmed

commit confirmed [timeout <1-86400>]

commit confirmed [accept|reject]

Applies the changes, but requires an explicit confirmation to become permanent.

The timeout period default is 600 seconds (10 mins.), or can be provisioned with a value of 1-86400 sec.). The timeout argument cannot be used with the accept or reject parameter.

Before the timer expires, the accept argument explicitly confirms and applies the changes. With no timer running, the reject argument explicitly rejects the changes.

annotate

Sets the annotation of the current node

discard [now|stay]

Discards all uncommitted changes; requires either a now or stay option (to stop unintended commit). When stay is used, the mode remains in candidate mode (opening a new transaction).

insert

Inserts the provided value into the specified user-ordered list.

Usage: insert <path-to-list> <value> <first|before|after|last>< value>

The provided value can be a single entry or a list. Use square brackets when specifying a list. In these examples, the provided values get added to an example community-set list named sample.
insert community-set sample member [ 1:1 1:2 ]
insert community-set sample member 1:1
  • first - Insert a value at the beginning of the user-ordered list

  • before - Insert a value in the user-ordered list before another specified value

  • after - Insert a value in the user-ordered list after another specified value

  • last - Insert a value at the end of the user-ordered list

    The optional after or before parameters, or the first and the last parameters, are mutually exclusive to place the value or values at an exact location in the list.
    Note: These parameters cannot be used for a system-ordered list.