Using the command line interface (CLI) : Command syntax
Command syntax
Specifying file names and locations in commands
Use only letters, numbers, hyphens, and underscores in filenames and locations. Do not use spaces or special characters. For example, my_file is an acceptable name; my&file is not.
Entering spaces in a command strings
Spaces are not allowed in strings that represent filenames or file locations.
When a string value, for other than a filename or locations, contains a space, do one of the following:
Enclose the string in quotation marks; "Security Administrator", for example.
Enclose the string in single quotes; 'Security Administrator', for example.
Use a backslash (“\”) preceding the space; Security\ Administrator, for example.
Entering quotation marks in strings
If you want to include a quotation mark, single quote or apostrophe in a string, you must precede the character with a backslash character. To include a backslash, enter two backslashes.
Entering a question mark (?) in a string
If you want to include a question mark (?) in a string, you must precede the question mark with CTRL-V. Entering a question mark without first entering CTRL-V causes the CLI to display possible command completions, terminating the string.
Special characters that are not permitted in commands
The characters <, >, (, ), #, ’, and ” are not permitted in most FortiDB CLI fields nor are they permitted in the passwords used to protect configuration-file backups.
Specifying IP address formats in commands
You can enter an IP address and subnet using either dotted decimal or slash-bit format. For example you can type either:
set ip 255
set ip
The IP address is displayed in the configuration file in dotted decimal format.
This guide uses the following conventions to describe command syntax:
Angle brackets < > indicate variables.
For example:
execute restore config <filename_str>
You enter:
execute restore config myfile.bak
Vertical bar and curly brackets {|} separate alternative, mutually exclusive required keywords.
For example:
set protocol {ftp | sftp}
You can enter:
set protocol ftp or set protocol sftp
Square brackets [ ] indicate that a keyword or variable is optional.
For example:
show system interface [<name_str>]username
To show the settings for all interfaces, you can enter show system interface. To show the settings for the Port1 interface, you can enter show system interface port1.
A space separates options that can be entered in any order and in any combination and that must be separated by spaces.
For example:
set allowaccess {https ping ssh}
You can enter any of the following:
- set allowaccess ping
- set allowaccess https ping
- set allowaccess ssh
- set allowaccess https ssh
- set allowaccess https ping ssh
In most cases to make changes to lists that contain options separated by spaces, you need to retype the whole list including all the options you want to apply and excluding all the options you want to remove.
Special characters:
The \ is supported to escape spaces or as a line continuation character
The single quotation mark ' and the double quotation mark are supported, but must be used in pairs.
If there are spaces in a string, you must precede the spaces with the \ escape character or put the string in a pair of quotation marks.
See also
Tips & tricks
Overview of commands