How to Determine the CLI Mode in Junos

Because of the hierarchy of the Junos command-line interface (CLI), you can always know just where you are in the command hierarchy. When you first log into the CLI, Junos places you in operational mode. You enter configuration mode by using the configure command:

In configuration mode, you must apply new commands precisely where they belong — for example, to a specific interface or policy group — so it's important that you know exactly where you are in the hierarchy. Fortunately, configuration mode uses indentation, which helps you recognize its hierarchy. This indentation may remind you of the outline you did in high school for your sophomore research paper.

Before looking at an example of a configuration listing, you may find it helpful to become familiar with two different types of configuration statements:

Container statements: Contain subordinate levels of the hierarchy.

Leaf statements: End a hierarchy — that is, they have no subordinate statements.

Now, here's an example configuration listing that shows off the svelte moves of configuration mode:

[edit]
system {
services {
ftp;
}
}

The [edit] banner indicates the starting hierarchical level of the listing.

Indentation of each subordinate level shows the configuration hierarchy. Here, ftp is under services, which is under system.

The CLI indicates container statements with open and closed curly braces ({ }). Here, system and services are container statements.

The CLI indicates leaf statements with a semicolon (;). Here, ftp; is a leaf statement.

Junos ensures that you can easily make your way up and down its configuration interface.

Before moving onward, you need one more smooth move of the CLI. In the preceding example, you find simply the [edit] banner at the very top of the configuration mode. But Junos allows you to look at this same setup from anywhere along its hierarchical path, for example:

[edit system services]
ftp;

In configuration mode, when you are in deeper levels of the hierarchy, the edit banner always gives you the complete hierarchical path. Here, [edit systems services] indicates that you are in the second level node of system, and then within it, you are in the third level node of services.

When you want to focus on only a small part of the configuration, having the flexibility to work at a specific sublevel of the hierarchy is helpful. Next, you find out how to move up and down the configuration.