Subcommands
Once you connect to the CLI, you can enter commands.
Each command line consists of a command word that is usually followed by words for the configuration data or other specific item that the command uses or affects, for example:
get system admin
Subcommands are available from within the scope of some commands. When you enter a subcommand level, the command prompt changes to indicate the name of the current command scope. For example, after entering:
config system admin
the command prompt becomes:
(admin)#
Applicable subcommands are available to you until you exit the scope of the command, or until you descend an additional level into another subcommand.
For example, the edit
subcommand is available only within a command that affects tables; the next
subcommand is available only from within the edit
subcommand:
config system interface
edit port1
set status up
next
end
Available subcommands vary by command. From a command prompt within config
, two types of subcommands might become available:
- Commands that affect fields (see Field commands)
- Commands that affect tables (see Table commands)
Subcommand scope is indicated in this (Undefined variable: FortinetVariables.Document title3) by indentation. For details, see Indentation. Syntax examples for each top-level command in this (Undefined variable: FortinetVariables.Document title3) do not show all available subcommands. However, when nested scope is demonstrated, you should assume that subcommands applicable for that level of scope are available. |
Table commands
delete <table_name> |
Remove a table from the current object. For example, in
|
edit <table_name> |
Create or edit a table in the current object. For example, in
|
end | Save the changes to the current object and exit the config command. This returns you to the top-level command prompt. |
get |
List the configuration of the current object or table.
For more information on |
purge |
Remove all tables in the current object. For example, in
Caution: Back up the FortiWeb appliance before performing a purge because it cannot be undone. To restore purged tables, the configuration must be restored from a backup. For details, see backup cli-config. Caution: Do not purge |
show |
Display changes to the default configuration. Changes are listed in the form of configuration commands. For more information on |
Example of table commands
From within the system admin
object, you might enter:
edit admin_1
The CLI acknowledges the new table, and changes the command prompt to show that you are now within the admin_1
table:
new entry 'admin_1' added
(admin_1)#
Field commands
abort | Exit both the edit and/or config commands without saving the fields. |
end | Save the changes made to the current table or object fields, and exit the config command. To exit without saving, use abort instead. |
get |
List the configuration of the current object or table.
|
next |
Save the changes you have made in the current table’s fields, and exit the
|
set <field_name> <value> |
Set a field’s value. For example, in Note: When using |
show | Display changes to the default configuration. Changes are listed in the form of configuration commands. |
unset <field_name> |
Reset the table or object’s fields to default values. For example, in |
Example of field commands
From within the admin_1
table, you might enter:
set password "my1stExamplePassword"
to assign the value my1stExamplePassword
to the password
field. You might then enter the next
command to save the changes and edit the next administrator’s table.