Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Understanding the Junos OS CLI Modes, Commands, and Statement Hierarchies

The Junos OS command-line interface (CLI) commands and statements are organized under two command modes and various hierarchies. The following sections provide you an overview of the Junos OS CLI command modes and commands and statements hierarchies:

Junos OS CLI Command Modes

The Junos OS CLI has two modes:

  • Operational mode—This mode displays the current status of the device. In operational mode, you enter commands to monitor and troubleshoot the Junos OS, devices, and network connectivity.
  • Configuration mode—A configuration for a device running on Junos OS is stored as a hierarchy of statements. In configuration mode, you enter these statements to define all properties of the Junos OS, including interfaces, general routing information, routing protocols, user access, and several system and hardware properties.

When you enter configuration mode, you are actually viewing and changing a file called the candidate configuration. The candidate configuration file enables you to make configuration changes without causing operational changes to the current operating configuration, called the active configuration. The router or switch does not implement the changes you added to the candidate configuration file until you commit them, which activates the configuration on the router or switch (see Figure 1). Candidate configurations enable you to alter your configuration without causing potential damage to your current network operations.

Figure 1: Committing a Configuration

Committing a Configuration

CLI Command Hierarchy

CLI commands are organized in a hierarchy. Commands that perform a similar function are grouped together under the same level of the hierarchy. For example, all commands that display information about the system and the system software are grouped under the show system command, and all commands that display information about the routing table are grouped under the show route command.

To execute a command, you enter the full command name, starting at the top level of the hierarchy. For example, to display a brief view of the routes in the routing table, use the command show route brief.

Configuration Statement Hierarchy

The configuration statement hierarchy has two types of statements: container statements, which are statements that contain other statements, and leaf statements, which do not contain other statements. All of the container and leaf statements together form the configuration hierarchy.

Figure 2 illustrates a part of the hierarchy tree. The protocols statement is a top-level statement at the trunk of the configuration tree. The ospf, area, and interface statements are all subordinate container statements of a higher statement (they are branches of the hierarchy tree), and the hello-interval statement is a leaf on the tree.

Figure 2: Configuration Statement Hierarchy Example

Configuration Statement Hierarchy
Example

Moving Among Hierarchy Levels

You can use the CLI commands in Table 1 to navigate the levels of the configuration statement hierarchy.

Table 1: CLI Configuration Mode Navigation Commands

Command

Description

edit hierarchy-level

Moves to an existing configuration statement hierarchy or creates a hierarchy and moves to that level.

exit

Moves up the hierarchy to the previous level where you were working. This command is, in effect, the opposite of the edit command. Alternatively, you can use the quit command. The exit and quit commands are interchangeable.

up

Moves up the hierarchy one level at a time.

top

Moves directly to the top level of the hierarchy.

Published: 2013-01-15