Accessing and using the CLI

Accessing the CLI

The Digital Sandbox software is installed on top of the Linux operating system. Once initialized, you can access the CLI. Standard Linux commands are accessible and formatting and filtering commands (such as grep, more, and so on) can be used with the Digital Sandbox CLI.

Executing CLI commands

After logging in, you are placed in the Digital Sandbox’s Linux operating system. The dsctl command controls all aspects of the local instance and proceeds all Digital Sandbox CLI commands. For example, to use the version CLI command, you would enter:

dsctl version

This command produces the following output:

$ dsctl version
Digital Sandbox  v0.0.0-169
$

Formatting and filtering output

Command output can be formatted or filtered using Linux commands such as pipe (‟|”), grep, awk, and so on.

Using the CLI help functions

The CLI help functions (help, -h, and --help) can assist in understanding command usage.

Enter help, -h, or --help after a command to display the command usage. For example, entering -h after the dsctl command shows its usage. For example:

[username1 ~]$ dsctl -h
Usage:
  dsctl [command]
Available Commands:
  abort       Aborts an ongoing update of a Digital Sandbox deployment
  connect     Connect (SSH) to a Network Element in a Digital Sandbox deployment
  create      Creation of a Digital Sandbox resource (deployment, phyconnect) 
              or Digital Sandbox configuration
  delete      Delete a Digital Sandbox resource/configuration
  help        Help about any command
  intent      Contains all intent related Digital Sandbox commands
  list        List a Digital Sandbox resource/configuration
  load        Load commands.
  logs        Retrieve a Gatenet log
  status      Get the status of a Digital Sandbox resource
  traffic     Traffic related commands
  update      Update a resource
  version     Print the version number of Digital Sandbox

Flags:
  -c, --config string      configuration file
  -h, --help               help for dsctl
      --log.level string   log level (default "info")
Use "dsctl [command] --help" for more information about a command.

You can also enter -h after a specific CLI command to show its usage. For example:

$ dsctl traffic -h
Digital Sandboxes allows injecting/capturing traffic a deployment. The commands in this structure
       will allow you not only to start/stop traffic injection or capturing but also to trigger analysis of the 
       captures and comparisons of two different traffic runs.


Usage:
  dsctl traffic [command]
Available Commands:
  analyze     Perform an analysis of traffic run
  compare     Compare two traffic runs
  create      Create Digital Sandbox traffic resources
  list        List Digital Sandbox traffic resources
  message     Message components of the Digital Sandbox.
Flags:
  -h, --help   help for traffic
Global Flags:
  -c, --config string      configuration file
      --log.level string   log level (default "info")
Use "dsctl traffic [command] --help" for more information about a command.

Within the help output, mandatory fields are denoted by (M).

Using the CLI auto-complete function

To reduce keystrokes or aid in remembering a command name, use the CLI auto-complete function.

Enter a tab at any level to auto-complete the next command level. If multiple options are available, a list will appear. The auto-complete function will also prompt for mandatory fields.

When a command is partially entered, the remainder of the command appears ahead of the prompt in lighter text. Press the Tab key to complete the command.

When the Tab key is pressed and there are multiple options, the options are shown:

Using CLI shortcuts

Use shortcuts to move the cursor on the command line, complete commands, and recall commands previously entered. Shortcuts can also make syntax correction easier. CLI keyboard shortcuts lists common shortcuts.

Table 1. CLI keyboard shortcuts

Task

Keystroke

Move cursor to the beginning of the line

Ctrl+A

Move cursor to the end of the line

Ctrl+E

Move cursor one character to the right

Ctrl+F or Right arrow key

Move cursor one character to the left

Ctrl+B or Left arrow key

Move cursor forward one word

Esc F

Move cursor back one word

Esc B

Transpose the character to the left of the cursor with the character the cursor is placed on

Ctrl+T

Complete a partial command

Enter the first few letters, then press the Tab key

Recall previous entry in the buffer

Page up key