Support Support Downloads Knowledge Base Juniper Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

SRX Getting Started - CLI Modes and Features



Article ID: KB15719 KB Last Updated: 30 Sep 2020Version: 4.0

This article describes Junos OS CLI modes and features.

For other topics, go to the SRX Getting Started main page.


Understand CLI modes and features.

This section contains the following:

CLI Modes

If you log in to the device as the root user, you enter the UNIX shell, which is indicated by the percent sign (%) as the prompt. To access the Junos CLI, enter the cli command at the shell prompt:

root% cli

The Junos 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 Junos OS and devices and network connectivity.
  • Configuration mode--A Junos device configuration is stored as a hierarchy of statements. In configuration mode, you enter these statements to define all properties of Junos OS, including interfaces, general routing information, routing protocols, flow-based security features, user access, and system and hardware properties.

Operational Mode

After logging in, you enter operational mode, which is indicated by the right angle bracket (>):


Configuration Mode

From operational mode, use the configure command to enter configuration mode, which is indicated by the pound sign (#):

user@host> configure

To exit configuration mode and go back to operational mode, enter exit at the prompt:

user@host# exit

Configuration Mode Commands

The following table lists some commonly used configuration mode commands.
 Command  Function
 set Use the set command to assign a value to a configuration parameter.
 delete Use the delete command to delete a configuration parameter. If deleting a parameter leaves the configuration statement empty, the emtpy statement is removed from the configuration.
 show Use the show command to display the configuration from the current configuration hierarchy level and sub-hierarchies. If you issue the show command from the top of the configuration hierarchy, the entire configuration is listed.
 commit Use the commit command to save the candidate configuration as the current (operational) configuration. For more information, see KB15721 - SRX Getting Started - Commit Configuration.
  • Use the copy command to copy a configuration statement to a new configuration statement with a different name, which can be useful if you have many similar configuration statements.
  • The copy command duplicates the statement and its entire hierarchy of statements.
  • Only use the copy command with configuration statements that include names for variables that you have defined.
  • Use the rename command to assign a new name to parameter name that you have previously defined (for example, interface names or policy statements).
  • In most cases, you can use the rename command to change a value.
  • Alternatively, you can use the delete command to remove a configuration statement and then use the set command to add the new value.

For a complete list of configuration mode commands, see Junos OS CLI Configuration Mode.


CLI Hierarchy

CLI commands are organized in a hierarchy. Commands that perform a similar function are grouped in the same hierarchy level. For example, all commands that display information about security functionality are in the show security hierarchy in operational mode.

For more information, see Understanding the Junos OS CLI Modes, Commands, and Statement Hierarchies.

Command Line Navigation

The Junos CLI supports Emacs-based key sequences. The following are some key sequences that you can use to navigate the command line:
  • Ctrl+b--Move the cursor one space back
  • Ctrl+a--Move the cursor to the beginning of the command line.
  • Ctrl+f--Move the cursor one space forward
  • Ctrl+e--Move the cursor to the end of the command line.
A VT100 terminal type supports use of the arrow keys for navigation.

For a complete list of keyboard sequences, see Using Keyboard Sequences to Move Around and Edit the Junos OS CLI.

Command and Variable Completion

You can use the spacebar or Tab key to complete command names. If you enter a partial string of characters that uniquely identify a command, the command name is completed. If you enter an ambiguous string, a list of possible completion options appears.

Use the Tab key to complete assigned variable names (for example, usernames and interface names).

Context-Sensitive Help

In operational and configuration modes, you can get context-sensitive help when you type a question mark (?) anywhere in the command line.

For example, if you are at the top level of the operational mode hierarchy and enter ?, you get a list of all available commands at that level.
user@host> ?
Possible completions:
  clear                Clear information in the system
  configure            Manipulate software configuration information
  file                 Perform file operations

user@host> clear ?
Possible completions:
  arp                  Clear address resolution information
  auto-configuration   Clear auto-configuration action
  bfd                  Clear Bidirectional Forwarding Detection information
  bgp                  Clear Border Gateway Protocol information
For more information about context-sensitive help, see Getting Online Help from the Junos OS Command-Line Interface.

Technical Documentation

Junos CLI User Guide - See 'Displaying the Current Junos OS Configuration'
Modification History:
2020-09-30: Minor, non-technical edits.
Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search