FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
tlegentil_FTNT
Article Id 195845
Description
This article presents some uses of the CTRL and ALT keys in the FortiOS CLI.

Solution
As those who have used Linux/Unix shells (where "Emacs key bindings" are used) may know, Ctrl-P and Ctrl-N are typically used to move up/down through the history. This is also true in Cisco IOS.

In FortiOS CLI, those key bindings do more than that. If you have not yet typed anything and you enter those key combinations, you go back to the previous/next line in the history list. However, if you type a string and then enter those combinations, it takes you to the previous/next occurrence of the string in the history list. This can be very useful and save time, especially when dealing with slow connections and complex commands.

For example:
dia sniffer packet port6 'host 10.1.1.1 and (tcp[tcpflags] & tcp-syn != 0)' 6 0 l
get router info routing-table all
get router info ospf neighbor
get router info ospf database
dia ip route list
After some time you want to enter the same sniffer command again. Do this:

type:
sniffer
and press 'ctrl-p'

By doing this, you will search the history list backwards, and go to the most recent occurrence of the string "sniffer" right away.

You can then use Ctrl-P and Ctrl-N to navigate through the list of all occurrences of the string in the history list.

Note that the FortiOS history list keeps the last 100 commands entered into the CLI.

A few other useful key bindings:
  • ctrl-a: Move to the beginning of the current line.
  • ctrl-e: Move to the end of the current line.
  • alt-f: Move forward to the end of the next word.
  • alt-b: Move to the start of the current or previous word.
  • alt-backspace: Delete from the cursor the start of the previous word. If between words, delete to the start of the previous word.
  • alt-d: Delete from the cursor to the end of the current word. If between words, delete to the end of the next word.
  • ctrl-d: Delete the character under the cursor.
  • ctrl-k: Delete from the cursor, up to the end of the line.
  • ctrl-y: Paste the most recent killed (deleted) text. (can be used in combination with ctrl-k, alt-backspace, ctrl-u, alt-d, and other "kill" commands)

Contributors