Knowledge Center Search


 

SRX Getting Started - CLI Modes and Features

  [KB15719] Show KB Properties

  [KB15719] Hide KB Properties

Categories:
Knowledge Base ID: KB15719
Last Updated: 23 Feb 2014
Version: 3.0

Summary:

This article describes Junos OS CLI modes and features.

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

Problem or Goal:

Understand CLI modes and features.

Cause:

Solution:
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
user@host>

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 (>):
user@host>

Configuration Mode

From operational mode, use the configure command to enter configuration mode, which is indicated by the pound sign (#):
user@host> configure
[edit]
user@host#
To exit configuration mode and go back to operational mode, enter exit at the prompt:
user@host# exit
user@host>

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.
 copy
  • 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.
 rename
  • 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'


Purpose:
Implementation

Related Links:

 

 

ASK THE KB

Question or KB ID:


 


 

 
Copyright© 1999-2012 Juniper Networks, Inc. All rights reserved.