Supported Platforms
Related Documentation
- M, MX, PTX, QFX, T Series
- Configuring CLI Tips
- QFX Series
- Overview of Navigating the CLI
- Other Tools to Configure and Monitor Devices Running Junos OS
- Additional Information
- CLI User Guide
CLI User Interface Overview
CLI Overview
The command-line interface (CLI) is the software interface you use to access, monitor, configure, troubleshoot, and manage a device running Junos OS. You can access the CLI either from the console or through a network connection. The CLI is a Juniper Networks-specific command shell that runs on top of a FreeBSD UNIX-based operating system kernel.
The CLI provides a variety of UNIX utilities, such as Emacs-style keyboard sequences, which allows you to perform the following actions:
- Move around on a command line and scroll through recently executed commands.
- Match regular expressions to locate and replace values and identifiers in a configuration.
- Filter command output.
- Log file entries.
- Store and archive device files on a UNIX-based file system.
You can exit the CLI environment and create a UNIX C shell or Bourne shell to navigate the file system, manage processes, and perform other tasks.
CLI Key Features
The CLI commands and statements follow a hierarchical organization and have consistent syntax. The CLI provides the following features for ease of use:
- Consistent command names—Commands that provide the same type of function have the same name, regardless of the portion of the software on which they are operating. For example, all show commands display software information and statistics, and all clear commands erase various types of system information.
- Lists and short descriptions of available commands—Information about available commands is provided at each level of the CLI command hierarchy. If you type a question mark (?) at any level, you see a list of the available commands along with a short description of each command. This means that if you already are familiar with the Junos OS, you can use many of the CLI commands without referring to the documentation.
- Command completion—Command completion for command names (keywords) and for command options is available at each level of the hierarchy. To complete a command or option that you have partially typed, press Tab or the Spacebar. If the partially typed letters begin a string that uniquely identifies a command, the complete command name appears. Otherwise, a beep indicates that you have entered an ambiguous command, and the possible completions are displayed. Completion also applies to other strings, such as filenames, interface names, usernames, and configuration statements.
CLI Command Modes
The CLI has two modes, operational mode and configuration mode.
- 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. Operational mode is indicated by the > prompt—for example, user@switch> clear
- Configuration mode—A Junos OS device configuration is stored as a hierarchy of statements. In configuration mode, you can define all properties of the Juniper Networks Junos OS, including interfaces, VLANs, Virtual Chassis information, user access, and several system hardware properties. To enter configuration mode, enter the configure command. Configuration mode is indicated by the # prompt and includes the current location in the configuration hierarchy—for example:
In configuration mode, you are actually viewing and changing the candidate configuration file. The candidate configuration allows you to make configuration changes without causing operational changes to the current operating configuration, called the active configuration. When you commit the changes you added to the candidate configuration, the system updates the active configuration. Candidate configurations enable you to alter your configuration without causing potential damage to your current network operations.
To activate your configuration changes, enter the commit command.
When you commit the candidate configuration, you can require an explicit confirmation for the commit to become permanent by using the commit confirmed command. This is useful for verifying that a configuration change works correctly and does not prevent management access to the switch. After you issue the commit confirmed command, you must issue another commit command within the defined period of time (10 minutes by default), or the system reverts to the previous configuration.
You can also activate your configuration changes and exit configuration mode with a single command, commit and-quit. This command succeeds only if there are no mistakes or syntax errors in the configuration.
To return to operational mode, go to the top of the configuration hierarchy and then quit—for example:
When you monitor and configure a device running Junos OS, you may need to switch between operational mode and configuration mode. When you change to configuration mode, the command prompt also changes. The operational mode prompt is a right angle bracket (>) and the configuration mode prompt is a pound sign (#).
When you log in to the switch and type the cli command, you are automatically in operational mode. To switch to configuration mode, type the configure command or the edit command.
The CLI prompt changes from user@switch> to user@switch#, and a banner appears to indicate the hierarchy level.
To return to operational mode as well as commit your changes, enter command and-quit. To return to operational mode without committing any of your changes, enter exit.
To display the output of an operational mode command, such as show, while in configuration mode, issue the run configuration mode command and then specify the operational mode command.
Related Documentation
- M, MX, PTX, QFX, T Series
- Configuring CLI Tips
- QFX Series
- Overview of Navigating the CLI
- Other Tools to Configure and Monitor Devices Running Junos OS
- Additional Information
- CLI User Guide
Published: 2013-08-15
Supported Platforms
Related Documentation
- M, MX, PTX, QFX, T Series
- Configuring CLI Tips
- QFX Series
- Overview of Navigating the CLI
- Other Tools to Configure and Monitor Devices Running Junos OS
- Additional Information
- CLI User Guide
Published: 2013-08-15
