Exercise 2: Working With the CLI
In this exercise, you will access a FortiGate using the CLI.
Explore the CLI
You will become familiar with the FortiGate CLI.
To explore the CLI
1. Go to the Local-FortiGate CLI.
2. At the login prompt, type admin.
3. In the Password field, type password, and then press Enter.
4. Enter the following command:
get system status
This command displays basic status information about FortiGate. The output includes the
FortiGate serial number, operation mode, and so on. When the More prompt appears on
the CLI, perform one of the following actions:
Action Command
To continue scrolling Press the space bar.
To scroll one line at a time Press Enter.
To exit Type q.
5. Enter the following command:
get ?
The ? character is not displayed on the screen.
This command shows all options that the CLI will accept after the get command.
Depending on the command, you may need to enter additional words to completely specify
a configuration option.
6. Press the up arrow key.
This displays the previous get system status command.
7. Try some of the control key sequences shown in the following table:
Action Command
Previous command Up arrow
Next command Down arrow
Beginning of line Ctrl+a
End of line Ctrl+e
Back one word Ctrl+b
Forward one word Ctrl+f
Delete current character Ctrl+d
Clear screen Ctrl+l
Abort command and exit Ctrl+c
Auto repeat history Ctrl+p
8. Enter the following command:
execute ?
This command lists all options that the CLI accepts after the execute command.
9. Type exe, and then press the Tab key.
Notice that the CLI completes the current word.
10. Press the space bar, and then press the Tab key three times.
Each time you press the Tab key, the CLI replaces the second word with the next possible
option for the execute command, in alphabetical order.
You can abbreviate most commands. In lessons and labs, many of the commands that
you see are in abbreviated form. For example, instead of typing execute, you can
type exe.
Use this technique to reduce the number of keystrokes that are required to enter a
command. Often, experts can configure FortiGate faster using the CLI than using the
GUI.
If there are other commands that start with the same characters, your abbreviation must
be long enough to be specific, so that FortiGate can distinguish them. Otherwise, the
CLI displays an error message about ambiguous commands.
11. On a new line, enter the following command to view the port3 interface
configuration (hint: try using the shortcuts you just learned about):
show system interface port3
12. Enter the following command:
show full-configuration system interface port3
Stop and think!
Compare both outputs. How are they different?
The show full-configuration command displays all the configuration settings for the interface.
The show command displays only those values that are different from the default values.
LAB-1 > Working With the CLI