This section contains the following topics:
For more information about the CLI, see the JUNOS CLI User Guide.
The CLI commands are organized hierarchically, with commands that perform a similar function grouped together under the same level. For example, all commands that display information about the device system and system software are grouped under the show command, and all commands that display information about the routing table are grouped under the show route command. Figure 1 illustrates a portion of the show command hierarchy.
Figure 1: CLI Command Hierarchy Example
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.
The hierarchical organization results in commands that have a regular syntax and provides the following features that simplify CLI use:
To start the CLI:
After you log in, you enter a UNIX shell.
The presence of the angle bracket (>) prompt indicates the CLI has started. By default, the prompt is preceded by a string that contains your username and the hostname of the router.
To exit the CLI and return to the UNIX shell, enter the quit command.
The CLI has two modes: operational and configuration. When you log in to the device and the CLI starts, you are at the top level of operational mode.
To view a list of top-level operational mode commands, type a question mark (?) at the command-line prompt.
user@host> ?
Possible completions: clear Clear information in the system configure Manipulate software configuration information file Perform file operations help Provide help information monitor Show real-time debugging information mtrace Trace multicast path from source to receiver ping Ping remote target quit Exit the management session request Make system-level requests restart Restart software process set Set CLI properties, date/time, craft interface message show Show system information ssh Start secure shell on another host start Start shell telnet Telnet to another host test Perform diagnostic debugging traceroute Trace route to remote host
At the top level of operational mode are a number of broad groups of CLI commands that are used to perform the following functions:
To control the CLI environment, see Configuring the CLI Environment. To enter configuration mode, see CLI Configuration Mode. For information about the other CLI operational mode functions, see the JUNOS Software Administration Guide.
To configure the device, including system parameters, routing protocols, security, interfaces, network management, and user access, you must enter configuration mode. In configuration mode, the CLI provides commands to configure the device, load a text (ASCII) file that contains the device configuration, activate a configuration, and save the configuration to a text file.
You enter configuration mode by entering the configure operational mode command. The CLI prompt changes from user@host> to user@host#.
To view a list of configuration mode commands, type a question mark (?) at the command-line prompt. (You do not need to press Enter after typing the question mark.)
user@host# ?
Possible completions: Enter Execute this command activate Remove the inactive tag from a statement annotate Annotate the statement with a comment commit Commit current set of changes copy Copy a statement deactivate Add the inactive tag to a statement delete Delete a data element edit Edit a sub-element exit Exit from this level help Provide help information insert Insert a new ordered data element load Load configuration from ASCII file quit Quit from this level rename Rename a statement rollback Roll back to previous committed configuration run Run an operational-mode command save Save configuration to ASCII file set Set a parameter show Show a parameter status Show users currently editing configuration top Exit to top level of configuration up Exit one level of configuration wildcard Wildcard operations
The JUNOS software configuration consists of a hierarchy of statements. There are two types of statements: container statements, which contain other statements, and leaf statements, which do not contain other statements. All the container and leaf statements together form the configuration hierarchy.
Each statement consists of a fixed keyword and, optionally, an identifier that you define, such as the name of an interface or a username.
To configure the device or to modify an existing configuration, you add statements to the configuration with the edit and set configuration mode commands. For more information about the CLI configuration editor and configuration mode, see the JUNOS Software configuration guides.
This section contains the following topics:
In the CLI, you use keystrokes to move around on and edit the command line, and to scroll through a list of recently executed commands. Table 4 lists some typical CLI editing tasks and the keystrokes that perform them.
Table 4: CLI Editing Keystrokes
You do not always have to remember or type the full command or option name for the CLI to recognize it. To display all possible command or option completions, type the partial command followed immediately by a question mark (?).
To complete a command or option that you have partially typed, press Tab or Spacebar. If the partially typed letters uniquely identify a command, the complete command name appears. Otherwise, a message indicates that your entry is ambiguous or invalid. Possible command completions are displayed if your entry is ambiguous.
You can also use command completion on filenames and usernames. To display all possible values, type one or more characters followed immediately by a question mark. To complete these partial entries, press Tab only. Pressing Spacebar does not work.
The CLI provides context-sensitive Help at every level of the command hierarchy. The Help information tells you which commands are available at the current level in the hierarchy and provides a brief description of each.
To get Help while in the CLI, type a question mark (?) in one of the following ways:
user@host# set schedulers ?
regress@arcona# set schedulers ? Possible completions: + apply-groups Groups from which to inherit configuration data + apply-groups-except Don't inherit configuration data from these groups > scheduler Scheduler configuration [edit] user@host# set schedulers
user@host> s?
Possible completions: set Set CLI properties, date/time, craft interface message show Show system information ssh Start secure shell on another host start Start shell
When you enter the help commands described in Table 5, the CLI displays usage guidelines and summary information for configuration statements and operational mode commands. You can enter help commands in operational or configuration mode.
Table 5: Help Commands
You can configure the CLI environment for your current login session. Your settings are not retained when you exit the CLI.
To display the current CLI settings, enter the show cli command:
user@host> show cli
CLI complete-on-space set to on CLI idle-timeout disabled CLI restart-on-upgrade set to on CLI screen-length set to 49 CLI screen-width set to 132 CLI terminal is 'vt100' CLI is operating in enhanced mode CLI working directory is '/cf/var/home/remote'
To change the CLI environment, use the set cli operational mode command:
user@host> set cli ?
Possible completions: complete-on-space Set whether typing space completes current word directory Set working directory idle-timeout Set maximum idle time before login session ends prompt Set CLI command prompt string restart-on-upgrade Set whether CLI prompts to restart after software upgrade screen-length Set number of lines on screen screen-width Set number of characters on a line terminal Set terminal type
Table 6 shows how you can change the CLI environment features.
Table 6: Configuring the CLI Environment