Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Hierarchy

The console allows the configuration of the router's settings using text commands. Since there is a lot of available commands, they are split into groups organized in a way of hierarchical menu levels. The name of a menu level reflects the configuration information accessible in the relevant section, eg. /ip hotspot.

...

Code Block
languageros
[admin@MikroTik] > ip route print 
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 # DST-ADDRESS PREF-SRC G GATEWAY DIS INTE... 
0 A S 0.0.0.0/0 r 10.0.3.1 1 bridge1 
1 ADC 1.0.1.0/24 1.0.1.1 0 bridge1 
2 ADC 1.0.2.0/24 1.0.2.1 0 ether3 
3 ADC 10.0.3.0/24 10.0.3.144 0 bridge1 
4 ADC 10.10.10.0/24 10.10.10.1 0 wlan1 
[admin@MikroTik] >

Instead of typing  /ip route path before each command, the path can be typed only once to move into this particular branch of menu hierarchy. Thus, the example above could also be executed like this:

...

Many of the command levels operate with arrays of items: interfaces, routes, users, etc. Such arrays are displayed in similarly looking lists. All items in the list have an item number followed by flags and parameter values.

...

Item numbers are assigned by the print command and are not constant - it is possible that two successive print commands will order items differently. But the results of last print commands are memorized and, thus, once assigned, item numbers can be used even after add, remove and move operations (since version 3, move operation does not renumber items). Item numbers are assigned on a per session basis, they will remain the same until you quit the console or until the next print command is executed. Also, numbers are assigned separately for every item list, so  the ip address print will not change the numbering of the interface list.

...

Warning: Do not use Item numbers in scripts, it is not a reliable way to edit items in  the scheduler. scripts, etc. Instead use find command. More info here also look at scripting examples.

...

There are two features in the console that help entering commands much quicker and easier - the [Tab] key completions, and abbreviations of command names. Completions work similarly to the bash shell in UNIX. If you press the [Tab] key after a part of a word, the console tries to find the command within the current context that begins with this word. If there is only one match, it is automatically appended, followed by a space:

...

It is possible to complete not only the beginning, but also any distinctive substring of a name: if there is no exact match, the console starts looking for words that have string being completed as first letters of a multiple word name, or that simply contain letters of this string in the same order. If single such word is found, it is completed at cursor position. For example:

...

  • edit - this command is associated with the set command. It can be used to edit values of properties that contain a large amount of text, such as scripts, but it works with all editable properties. Depending on the capabilities of the terminal, either a fullscreen editor, or a single line editor is launched to edit the value of the specified property.
  • find - The find command has the same arguments as set, plus the flag arguments like disabled or active that take values yes or no depending on the value of respective flag. To see all flags and their names, look at the top of print command's output. The find command returns internal numbers of all items that have the same values of arguments as specified.
  • move - changes the order of items in list.
    • Parameters
      • first argument specifies the item(-s) being moved.
      • the second argument specifies the item before which to place all items being moved (they are placed at the end of the list if the second argument is omitted).
  • print - shows all information that's accessible from particular command level. Thus, /system clock print shows system date and time, /ip route print shows all routes, etc. If there's a list of items in current level and they are not read-only, i.e. you can change/remove them (example of read-only item list is /system history, which shows a history of executed actions), then print command also assigns numbers that are used by all commands that operate with items in this list.
    • Common Parameters
      • from - show only specified items, in the same order in which they are given.
      • where - show only items that match specified criteria. The syntax of where  the property is similar to the find command.
      • brief - forces the print command to use tabular output form
      • detail - forces the print command to use property=value output form
      • count-only - shows the number of items
      • file - prints the contents of the specific submenu into a file on the router.
      • interval - updates the output from the print command for every interval seconds.
      • oid - prints the OID value for properties that are accessible from SNMP
      • without-paging - prints the output without stopping after each screenful.
  • remove - removes specified item(-s) from a list.
  • set - allows you to change values of general parameters or item parameters. The set command has arguments with names corresponding to values you can change. Use ? or double [Tab] to see list of all arguments. If there is a list of items in this command level, then set has one action argument that accepts the number of item (or list of numbers) you wish to set up. This command does not return anything.

...

Console line editor works either in multiline mode or in single-line mode. In multiline mode line editor displays complete input line, even if it is longer than single terminal line. It also uses a full-screen editor for editing large text values, such as scripts. In single-line mode only one terminal line is used for line editing, and long lines are shown truncated around the cursor. Full A full-screen editor is not used in this mode.

Choice of modes depends on detected terminal capabilities.

...

ist of keys

Control-C keyboard C keyboard interrupt. Control-D log D log out (if input line is empty)Control-K clear K clear from cursor to the end of lineControl-X toggle safe modeControl-V toggle hotlock mode modeF6 toggle cellarF1 or ? show X toggle safe modeControl-V toggle hotlock mode modeF6 toggle cellarF1 or ? show context sensitive help. If the previous character is \, then inserts literal literal ?.Tab perform line completionTab perform line completion. When pressed second time, show possible completions.Delete remove Delete remove character at cursorControl-H or Backspace remove Backspace remove character before cursor and move cursor back one position.Control-\  split split line at cursor. Insert newline at cursor position. Display second of the two resulting lines.Control-B or Left move Left move cursor backwards one characterControl-F or Right move Right move cursor forward one characterControl-P or Up go Up go to previous line. If this is the first line of input then recall previous input from history.Control-N or Down go Down go to next line. If this is the last line of input then recall next input from history.Control-A or Home move Home move cursor to the beginning of the line. If cursor is already at the beginning of the line, then go to the beginning of the first line of current input.Control-E or End move End move cursor to the end of line. If cursor is already at the end of line, then move it to the end of the last line of current input.Control-L or F5 reset F5 reset terminal and repaint screen.

...

The console has a built-in help, which can be accessed by typing ?. General The general rule is that help helps shows what you can type in a position where the ? was pressed (similarly to pressing [Tab] key twice, but in verbose form and with explanations).

...

  • [u] - undoes all safe mode changes, and puts the current session in safe mode.
  • [r] - keeps all current safe mode changes, and puts current session in a safe mode. Previous The previous owner of safe mode is notified about this:

...

When HotLock mode is enabled commands will be auto-completed.

To enter/exit HotLock mode press [CTRL]+[V].

Code Block
languageros
[admin@MikroTik] /ip address> [CTRL]+[V]
[admin@MikroTik] /ip address>>

Double>>is an indication that HotLock mode is enabled. For example, if you type/in e, it will be auto-completed to

Code Block
languageros
[admin@MikroTik] /ip address>> /interface ethernet 

Quick Help menu

F6 key enables a menu at the bottom of the terminal which shows common key combinations and their usage.

...