Sub-commands
Each command line consists of a command word that is usually followed by configuration data or other specific item that the command uses or affects:
get system admin
Sub-commands are available from within the scope of some commands. When you enter a sub-command 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 sub-commands are available to you until you exit the scope of the command, or until you descend an additional level into another sub-command.
For example, the edit
sub-command is available only within a command that affects tables; the next
sub-command is available only from within the edit
sub-command:
config system interface
edit
port1
set status up
next
end
Sub-command scope is indicated by indentation.
Available sub-commands vary by command. From a command prompt within config
, two types of sub-commands might become available:
- commands affecting fields
- commands affecting tables
Commands for tables
clone <table> |
Clone (or make a copy of) a table from the current object. For example, in
In
|
delete <table> |
Remove a table from the current object. For example, in
|
edit <table> |
Create or edit a table in the current object. For example, in
In objects such as security policies, |
end |
Save the changes to the current object and exit the |
get | List the configuration of the current object or table.• In objects, get lists the table names (if present), or fields and their values.• In a table, get lists the fields and their values.For more information on get commands, see the CLI Reference. |
purge | Remove all tables in the current object.For example, in config user local , you could type get to see the list of user names, then type purge and then y to confirm that you want to delete all users.purge is only available for objects containing tables.Caution: Back up the FortiGate before performing a purge . purge cannot be undone. To restore purged tables, the configuration must be restored from a backup.Caution: Do not purge system interface or system admin tables. purge does not provide default tables. This can result in being unable to connect or log in, requiring the FortiGate to be formatted and restored. |
rename <table> to <table> | Rename a table.For example, in config system admin , you could rename admin3 to fwadmin by typing rename admin3 to fwadmin .rename is only available within objects containing tables. |
show | Display changes to the default configuration. Changes are listed in the form of configuration commands. |
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)#
Commands for fields
abort |
Exit both the |
append |
Add an option to an existing list. |
end |
Save the changes made to the current table or object fields, and exit the |
get |
List the configuration of the current object or table.
|
move |
Move an object within a list, when list order is important. For example, rearranging security policies within the policy list. |
next |
Save the changes you have made in the current table’s fields, and exit the
|
select |
Clear all options except for those specified. For example, if a group contains members A, B, C, and D and you remove all users except for B, use the command |
set <field> <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. |
unselect |
Remove an option from an existing list. |
unset <field> |
Reset the table or object’s fields to default values. For example, in |
Example of field commands
To assign the value my1stExamplePassword
to the password
field, enter the following command from within the admin_1
table:
set password my1stExamplePassword
Next, to save the changes and edit the next administrator's table, enter the next
command.