Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: typos

Table of Contents

The console is used for accessing the MikroTik Router's configuration and management features using text terminals, either remotely using a serial port, telnet, SSH, console screen within WinBox, or directly using monitor and keyboard. The console is also used for writing scripts. This manual describes the general console operation principles. Please consult the Scripting Manual on some advanced console commands and on how to write scripts.

...

Example: admin+c80w - will disable console colors and set terminal width to 80.

ParamDefaultImplicitDescription
"w"autoautoSet terminal width
"h"autoautoSet terminal height
"c"onoffdisable/enable console colors
"t"onoffDo auto-detection of terminal capabilities
"e"onoffEnables "dumb" terminal mode

Banner and Messages

The login process will display the MikroTik banner and short help after validating the user name and password.

...

After the banner can be printed other important information, like /system note set by another admin, the last few critical log messages, demo version upgrade reminder, and default configuration description.

For example, the demo license prompt and last critical messages are printed

...

At the end of the successful login sequence, the login process prints a banner that shows the command prompt, and hands over control to the user.

...

Code Block
languagetext
themeFadeToGrey
  [admin@MikroTik] > interface [enter]
  [admin@MikroTik] /interface> / [enter]
  [admin@MikroTik] >

Use up arrow to recall previous commands (if this is a multiline command, then you can press F8 in order to expand it) from command history (commands that added sensitive data, like passwords, will not be available in the history), TAB key to automatically complete words in the command you are typing, ENTER key to execute the command, Control-C to interrupt currently running command and return to prompt and ? to display built-in help, in RouterOS v7, F1 has to be used instead.

The easiest way to log out of the console is to press Control-D at the command prompt while the command line is empty (You can cancel the current command and get an empty line with Control-C, so Control-C followed by Control-D will log you out in most cases).

...

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 the 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 /ip address print will not change the numbering of the interface list.

...

There are some commands that are common to nearly all menu levels, namely: print, set, remove, add, find, get, export, enable, disable, comment, move. These commands have similar behavior throughout different menu levels.

PropertyDescription
addThis command usually has all the same arguments as a set, except the item number argument. It adds a new item with the values you have specified, usually at the end of the item list, in places where the order of items is relevant. There are some required properties that you have to supply, such as the interface for a new address, while other properties are set to defaults unless you explicitly specify them.

Common Parameters

  • copy-from - Copies an existing item. It takes default values of a new item's properties from another item. If you do not want to make an exact copy, you can specify new values for some properties. When copying items that have names, you will usually have to give a new name to a copy
  • place-before - places a new item before an existing item with a specified position. Thus, you do not need to use the move command after adding an item to the list
  • disabled - controls disabled/enabled state of the newly added item(-s)
  • comment - holds the description of a newly created item

Return Values

  • add command returns the internal number of
item
  • items it has added
editThis 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 full-screen editor or a single line editor is launched to edit the value of the specified property.
findThe find command has the same arguments as a set, plus the flag arguments like disabled or active that take values yes or no depending on the value of the respective flag. To see all flags and their names, look at the top of the print command's output. The find command returns internal numbers of all items that have the same values of arguments as specified.
moveChanges the order of items in the list. Parameters:
  • the 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
hows
Shows all information that
\
's accessible from a particular command level. Thus, /system clock print shows the system date and time, /ip route print shows all routes etc. If there\'s a list of items in the 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.
    • append - 
    • brief - forces the print
    brief - forces the print
    • command to use tabular output form
    • count-only - shows the number of items
    • 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 sub-menu into a file on the router.
  • interval - updates the output from the print command for every interval seconds.
    • follow - 
    • follow-only - 
    • follow-strict - 
    • from - show only specified items, in the same order in which they are given.
    • interval - updates the output from the print command for every interval of seconds.
    • oid - prints the OID
    oid - prints the OID
    • value for properties that are accessible from SNMP.
    without
    • proplist -
    paging
    • comma-separated and ordered list of property names that should be included for the returned items.
    • show-ids - 
    • where - show only items that match specified criteria. The syntax of where the property is similar to the find command.
    • without-paging - prints the output without stopping after each screenful.
    removeRemoves specified item(-
    - prints the output without stopping after each screenful.removeRemoves specified item(-
    s) from a list.
    setAllows 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 a list of all arguments. If there is a list of items in this command level, then the set has one action argument that accepts the number of
    item
    items (or list of numbers) you wish to set up. This command does not return anything.

    Input Modes

    It is possible to switch between several input modes:

    • Normal mode - indicated by normal command prompt.
    • Safe mode - safe mode is indicated by the word SAFE after the command prompt. In this mode, the configuration is saved to disk only after the safe mode is turned off. Safe mode can be turned on/off with Ctrl+cX or F4. Read more >>
    • Hot-lock mode - indicated by additional yellow >. Hot-lock mode autocompletes commands and can be turned on/off with Ctrl+v F7

    Quick Typing

    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 sub-string 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 a single such word is found, it is completed at the cursor position. For example:. For example:

    [admin@MikroTik] > interface x[TAB]_
    [admin@MikroTik] > interface export _
    
    [admin@MikroTik] > interface mt[TAB]_
    [admin@MikroTik] > interface monitor-traffic _
    

    Console Search

    Console search allows performing keyword search through the list of RouterOS menus and the history. The search prompt is accessible with the [Ctrl+r] shortcut. 

    Internal Chat System

    RouterOS console has a built-in internal chat system. This allows remotely located admins to talk to each other directly in RouterOS CLI. To start the conversation prefix the intended message with the # symbol, anyone who is logged in at the time of sending the message will see it.

    Code Block
    languagetext
    themeFadeToGrey
    [admin@MikroTik] >

    ...

     # ready to break internet?
    [admin@MikroTik] > 
    fake_admin: i was born ready
    [admin@MikroTik] > 

    ...


    Code Block
    languagetext
    themeFadeToGrey
    [fake_admin@MikroTik] > 
    admin: ready to break internet?
    [fake_admin@MikroTik] > # i was born ready
    [fake_admin@MikroTik] > 

    List of Keys

    KeyDescription
    Control-Ckeyboard interrupt
    Control-Dlog out (if an input line is empty)
    Control-Kclear from the cursor to the end of the line
    Control-Uclear from the cursor to the beginning of the line
    Control-X or F4toggle safe mode
    Control-V
    F7toggle hot lock mode mode
    Control-R or F3toggle console search
    F6toggle cellar
    F1
    or ?
    show context-sensitive help
    . If the previous character is \, then inserts literal ?
    .
    Tabperform line completion. When pressed a second time, show possible completions.
    #Send a message to an internal chat system
    Deleteremove character at the cursor
    Control-H or Backspace
    remove
    removes character before cursor and
    move
    moves the cursor back one position.
    Control-\split line at cursor. Insert newline at the cursor position. Display second of the two resulting lines.
    Control-B or Leftmove cursor backward one character
    Control-F or Rightmove cursor forward one character
    Control-P or Upgo to the previous line. If this is the first line of input then recall previous input from history.
    Control-N or Downgo to the next line. If this is the last line of input then recall the next input from the history
    Control-A or Homemove the cursor to the beginning of the line. If the cursor is already at the beginning of the line, then go to the beginning of the first line of the current input
    Control-E or Endmove the cursor to the end of the line. If the cursor is already at the end of the line, then move it to the end of the last line of the current input
    Control-L or F5reset terminal and repaint screen