Introduction · Topic 3 of 8

RouterOS Command Line Access and CLI Principles

Learn the ways to open the RouterOS command line, from serial cable to SSH, and the CLI principles of tab completion, question mark help and history.

  • 5 min
In a nutshell
  • A null modem cable gives serial console access with no IP configuration.
  • SSH is encrypted and Telnet is not, and both need their service enabled.
  • WinBox and WebFig can both open a new terminal.

What it is

The RouterOS command line, or CLI, is a text interface that gives access to every setting.

You can open it in several ways, from a serial cable to a terminal inside WinBox. Once you are in, a few habits make the CLI fast: completion with the tab key, help with the question mark, simple navigation and command history.

The CLI uses a menu tree. Every feature lives at a path such as /ip address or /interface bridge.

Admin PCterminalserial, SSH, Telnet, WinBoxRouterRouterOS CLImenu treeCommandpath and action

How it works

First you choose how to reach the CLI, and then you use the editing keys to work quickly.

Ways to open the CLI

MethodNeedsNotes
Null modem cableSerial port on the router and a terminal programWorks with no IP configuration at all
SSHIP reachability and the ssh serviceEncrypted, so preferred
TelnetIP reachability and the telnet serviceClear text, so avoid on untrusted networks
New terminal in WinBox or WebFigAn existing WinBox or WebFig sessionOpens a CLI inside the tool

A null modem cable is a serial console cable. It is the tool of last resort, because it needs no IP address and works even when the network configuration is broken. The serial settings used by your model are listed in its documentation.

SSH and Telnet are network services. Both must be enabled on the router and reachable from the PC. SSH encrypts the session and Telnet does not, so SSH is the safe choice.

In WinBox you open a New Terminal from the menu bar. WebFig has a terminal as well. Both give you the same CLI as a serial or SSH session.

Menu tree and navigation

The CLI is organised as a tree of menus. You can type a full path from the root, or move into a menu and run short commands there.

/ip address print
/ip address
print
..
/
  • A path that starts with / is taken from the root.
  • Typing a menu name moves you into it, and the prompt changes to show where you are.
  • .. moves up one level.
  • / returns to the root.

Most menus share the same verbs: print, add, set, remove, enable, disable and export. Learning these once lets you work in any menu.

Tab and double tab

The tab key completes a word. If only one command starts with what you typed, tab finishes it.

A double tab lists every option that matches. It is the quickest way to see which commands or parameters exist at your current position.

RouterOS also accepts shortened words, as long as the part you type cannot match two commands. So /ip ad pr can stand for /ip address print, but a prefix that fits two commands is rejected.

Question mark help

Typing ? at any point shows the commands or parameters that are valid there, each with a short description.

/ip address ?
/ip address add ?

The first line lists the verbs of the menu. The second lists the parameters of add. Use this instead of guessing, because it always matches the installed RouterOS version.

Command history

The up and down arrow keys step through commands you typed earlier. You can edit a recalled command and run it again.

History saves typing and avoids mistakes. A long firewall rule can be recalled, changed in one parameter and run as a new rule.

The CLI also supports Safe Mode, which is switched on from the terminal with a key combination. While it is on, changes are undone if the connection to the router is lost. This protects you from locking yourself out with a bad change.

Exam tip

When you are not sure what a parameter is called, type the command, then ?, and read the list instead of guessing.

What to remember for the exam

Seven facts cover this topic.

  • A null modem cable gives serial console access with no IP configuration.
  • SSH is encrypted and Telnet is not, and both need their service enabled.
  • WinBox and WebFig can both open a new terminal.
  • A path starting with / is taken from the root, .. goes up one level.
  • Tab completes, and double tab lists the matching options.
  • ? shows the valid commands or parameters at that point.
  • The arrow keys recall earlier commands, so you can reuse and edit them.
Watch out

A shortened command is accepted only when it is unambiguous, so a prefix that matches two commands will fail.

Common mistakes

These four errors slow people down.

Using Telnet over an untrusted network. The session is clear text, so use SSH.

Forgetting the current menu. A command typed in the wrong menu fails or changes the wrong thing, so check the prompt.

Typing from memory instead of using help. The question mark and double tab show the real options.

Retyping long commands. Recall them with the arrow keys and edit the one part that must change.

Check yourself

Work through these three questions.

  • Which access method needs no IP configuration on the router?

    A null modem cable, because it is a serial console. SSH, Telnet and a WinBox terminal all need IP reachability or an existing session.

  • What is the difference between tab and double tab?

    Tab completes a word when only one command matches. Double tab lists all options that match at that point.

  • How do you move up one menu level and how do you return to the root?

    Type .. to move up one level. Type / to return to the root.

Topic 3 of 8 in Introduction

Test yourself on Introduction

The full MikroTik MTCNA question bank has 558 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by MikroTik. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.