CLI

The command line interface (CLI) is used to perform administration tasks when accessing the device over a terminal interface. Administration tasks include changing configuration, viewing status, and running commands.

The structure of the CLI commands and printed data is consistent with the structure of the web interface's administration pages. See the Administration reference section of this manual for documentation on the structure and content of this data.

Using the CLI

When the CLI starts, the main prompt is printed:

(cli)>

Typing ? shows contextual information and suggestions for autocompletion:

Gearlinux CLI

config  Enter configuration mode.
show    Enter show mode.
run     Run a command.
exit    Exit the CLI.

Pressing the TAB key also shows the suggestions list, and will autocomplete the word if the start of a word already entered prefixes one of the suggestions. The CLI supports line editing.

Configuration and status data is printed in YAML format. Output text that exceeds the height of the terminal is paged. When paged, pressing the space key shows the next page of text, pressing r prints the remaining text, and q cancels the pager without printing.

Basic configuration command

The CLI can be used to inspect and change the device's configuration. While at the main CLI prompt, the config command interacts with the device's current configuration, and is updated automatically when the device's configuration changes by automations or other administration sessions.

To print configuration, enter config keyword and the administration path, then press enter.

(cli)> config <PATH>

For example, to print details of the device at path system info:

(cli)> config system info
name: null
location: null
contact: null

To make simple configuration changes to string, integer, boolean, selection, and reference data types, append a value to the print command.

(cli)> config <PATH> <VALUE>

For example, to set the device's name system info name to nr44-bay18

(cli)> config system info name nr44-bay18

Multiple values can be set in one command by adding another path (relative to the previous set field) and value.

(cli)> config system info name nr44-bay18 location "Data center 1"

The changes are applied and saved to disk if they pass validation.

Configuration mode

Configuration mode allows advanced configuration changes, including adding or deleting items of a list, reverting configuration to defaults, and applying configuration changes without saving them to disk, require using the configuration mode. In configuration mode, a copy of the device's current configuration is made available for editing so that multiple operations can be performed before saving.

Enter configuration mode by running config with no parameters.

(cli)> config

The syntax of the basic configuration command, without the leading config keyword, is used to show and change the configuration.

(config)> system info name nr44-bay18

(config)> system info
name: nr44-bay18
location: null
contact: null

The following commands are available:

add       Add an item.
delete    Delete an item or value.
cd        Change data path.
validate  Validate the configuration.
apply     Apply the configuration.
save      Save the configuration to disk.
default   Revert to default.
discard   Discard the configuration changes.
changes   Show unapplied changes.
exit      Leave configuration mode without saving.

Enter the command keyword followed by ? to view help for the command.

When the configuration has been edited as required, run the save command to apply the configuration changes and save them to disk. The save command will fail if any configuration fields are invalid.

(config)> save

Run the exit command to return to the main CLI prompt.

(config)> exit
(cli)>

Show state command (configuration and status)

The CLI can be used to inspect the device's state. While at the main CLI prompt, the show command prints the device's current configuration and status, and is updated automatically.

To print state, enter the show keyword and the administration path, then press enter.

(cli)> show <PATH>

For example, to print details of the device at path system info:

(cli)> show system info
name: null
hostname: NR4416-0110923000657
mac: d4:c3:b0:01:03:b0
serial: NR4416-0110923000657
location: null
contact: null

Running commands

The CLI can be used to run administrative operation commands.

To run a command, enter the run keyword and the administration path, then parameters using the configuration set path/value syntax.

For example, backing up the configuration to the local configuration store with the name backup 2023-06-15:

(cli)> run system config save-to-store name "backup 2023-06-15"

Command succeeded.

To run a command with no parameters, or default parameters (if available), omit the parameters. For example, restart the device by running the command:

(cli)> run system operations restart

System restarting.