Welcome to the CLI Modes and Features module. By the end of this module, you should be able to describe the Junos CLI and it's features. The Junos CLI is a text-based command shell. One option for accessing the CLI, is through the out-of-band serial console connection. The console port settings are predefined and are not user configurable. On virtualized Junos OS devices, such as the vSRX and VMX, the out-of-band console is provided by the hypervisor virtual console. The second option for accessing the CLI, is over the network using access protocols such as Telnet or SSH. Unlike the console connection, these access options require the configuration of a network port and the Access Protocol. Many platforms running the Junos OS also offer a dedicated management Ethernet port. This management port provides out-of-band access. Therefore, the software cannot forward transit traffic through this management port. The actual name of the dedicated management Ethernet port varies between platforms. For details on a specific platform, refer to the Juniper Networks TechLibrary website. You can access the website from the reference links document. Junos OS requires a username and a password for access. The administrator creates user accounts and assigns permissions. All platforms running the Junos OS have only the root user configured by default without any password. When configured, the console login displays the host name of the device. When you have not configured a host name, as is the case with a factory default configuration, the software displays amnesiac in place of the host name. The root user has complete access and control of the device. When you log in as the root user, the software places you at the Unix shell. You must start the CLI by typing the CLI command. When you exit the CLI, you return to the Unix shell. For security reasons, ensure that you also log out of the shell by using the Exit command. Non-root users are placed in the Junos CLI automatically. They can access the shell if required and if permissions allow, by using the Start shell command. In the operational mode, you use the Junos CLI to monitor and troubleshoot a device. Commands like Monitor, Ping, Show, Test, and Trace route enable you to display information in test network connectivity for a device. In configuration mode, you can configure all properties of Junos OS, including interfaces, protocols, and user access, as well as several system hardware properties. The CLI provides context sensitive help at any point in a command line in both operational and configuration modes. Help notifies you which options are acceptable at the current point in the command and provides a brief description of each command or the command option to receive help at anytime while in the Junos CLI, type a question mark. You do not need to press "Enter". If you type the question mark at the command line prompt, the CLI lists the available commands and options, including user-defined variables at the appropriate context. If you type the question mark after entering the complete name of a command or an option, the CLI lists the available commands and options and then redisplays the command name and options that you typed. If you type the question mark in the middle of a command name, the CLI lists possible command completions that match the letters you have entered so far. Then re-displays the letters that you typed. The CLI provides a completion function. Therefore, you are not always required to type the full command or the command option name for the CLI to recognize it. To complete a command or an option that you have partially typed, press the space bar. If the partially typed letters begin a string that uniquely identifies a command, the CLI displays the complete command name. Otherwise, the CLI beeps to indicate that you have entered an ambiguous command and it displays the possible completions. The command completion option is on by default, but you can turn it off. To disable command completion for an individual user's session, issue the "Set CLI complete-on-space off" command. You can use the tab key to complete system commands and user-defined variables. Examples of variables include policy names, autonomous system or AS paths, community names, and IP addresses. The Tab key also offers a list of possible completions if multiple ambiguous options exist. Command completion enables you to save time by reducing your keystrokes and prevents errors by accurately referencing the desired user-defined variables. The CLI supports Emacs-style keyboard sequences that permit you to move the cursor on a command line and delete specific characters or words. This table lists the supported sequences. Please note that when using the Escape key, you must release the key and press it again for each occurrence. This action differs from the Control key, which you can hold down for multiple occurrences. Junos OS defaults to a VT100 terminal type. This terminal type enables the use of keyboard arrow keys without any additional session or configuration modification. For operational and configuration commands that display output, such as the show commands, you can filter the output. When help is displayed for these commands, one of the options listed is called a pipe that enables the command output to be filtered. To filter the output of an operational mode or a configuration mode command, add a pipe and an option to the end of the command. The append option is used to append output text to an existing file. The compare option is available in configuration mode using the show command. It compares configuration against another configuration file. The count option displays the number of lines in the output. The display change option is available in configuration mode only. It displays configuration that is tagged with the Juno's changed attribute. The display commit scripts option displays configuration data after Juno's OS applies any commit scripts. The display detail option is available in configuration mode and displays additional information about the contents of the configuration. The display inheritance option is available in configuration mode and displays inherited configuration data and the source configuration group. The display omit option omits configuration statements containing the omit option. The display set option displays the Juno's OS set commands that created the configuration statements. The display XML option displays output in XML format. The display JSON option displays the output in JavaScript Object Notation or JSON format. There are other options available to filter the output. The except regular expression option ignores text matching a regular expression when searching the output. If the regular expression contains spaces, operators, or wildcard characters, you must enclose it in quotation marks. The find regular expression option displays the output starting at the first occurrence of text matching a regular expression. If the regular expression contains spaces, operators, or wildcard characters, you must enclose it in quotation marks. The hold option holds text without exiting the more prompt. The last option displays the last screen of information. The match regular expression option searches for text matching a regular expression. If the regular expression contains spaces, operators, or wildcard characters, you must enclose it in quotation marks. The no-more option displays output all at once rather than one screen at a time. The refresh option enables you to refresh a continuous display of the command at a specified time interval. The request message option displays output to multiple users. The resolve option converts IP addresses to Domain Name System or DNS names. The option truncates to fit original size unless you specify full names. The save file name option saves the output to a file or URL. The tee option writes command output both to standard output and file. The trim option trims a specified number of columns from the start line. You can cascade multiple instances of the CLI's pipe functionality, which can be very beneficial when you must search extensive output displayed by the CLI for specific information. You use operational modes CLI commands to monitor and control the operation of a device running Juno's OS. The operational mode commands exist in a hierarchical structure. For example, the show command displays various types of information about the system and its environment. One of the possible options for the show command is OSPF that displays information about the OSPF protocol, specifying the interface option, as in the show OSPF interface command outputs information about OSPF interfaces. Juno's OS also adds additional flexibility through the run command that enables you to issue operational mode commands while in configuration mode. You enter configuration mode by issuing the configure command from the Juno's CLI's operational mode. If you enter configuration mode and another user is also in configuration mode, a message indicates who the user is and what portion of the configuration the user is viewing or editing. In configuration mode, the prompt changes from the angle bracket of the operational mode to the pound sign, preceded by the name of the user and the host name of the device. The portion of the prompt in brackets, such as edit, is a banner indicating that you are in configuration mode and identifies your location within the configuration hierarchy. By default, multiple users can enter configuration mode and commit changes. This is called shared configuration. Use the configure exclusive command to allow only a single user to edit the configuration. Uncommitted changes are always discarded when you use the configure exclusive command. In contrast, uncommitted changes are retained where you use the standard configure command. Entering configuration mode using the configure private command allows multiple users to edit the configuration while committing only their private changes. If private users issue a rollback zero command, the software discards only their changes. When a user is in private mode, other users must enter private mode or use configure exclusive to become the primary user or they cannot modify the candidate configuration. Exiting the private configuration without committing changes results in the loss of any modifications made to the private candidate configuration. If a user is in a shared configuration mode and has altered the candidate configuration, other users cannot enter configuration mode using the exclusive or private options. The changes made by the first user must be committed or canceled prior to any other users entering configuration mode with the exclusive or private options. Unlike software from other vendors, configuration changes made in Junos OS do not take effect immediately. This design feature permits you to group together and apply multiple configuration changes to the running configuration as a single unit. The active configuration is the configuration currently operational on the system and is the configuration the system loads during the boot sequence. This concept is analogous to both the running configuration and startup configuration in software from other vendors. The candidate configuration is a temporary configuration that might possibly become the active configuration. When you configure a device running Junos OS, the software creates a candidate configuration and initially populates it with the copy of the active configuration running on that device. You then modify the candidate configuration. Once satisfied with your modifications, you can commit the changes. This action causes the candidate configuration to become the active configuration. The configure command causes a candidate configuration to be created and populated with the contents of the active configuration. You can then modify the candidate configuration with your changes. To have a candidate configuration take effect, you must commit the changes. At this time, Junos OS checks the candidate configuration for proper syntax, and it installs it as the active configuration. If the syntax is not correct, an error message indicates the location of the error and the software does not activate any part of the configuration. You must correct the errors before recommitting the configuration. You can easily recover previous configurations by using a rollback command. Juno's OS maintains a configuration history by storing previously active configurations. The software saves a maximum of 50 configurations. This number includes the current active configuration, which is also known as rollback 0, and up to 49 previously active configurations. If you perform a rollback operation, keep in mind that the related configuration does not become active until you issue a commit. When you issue a commit and 50 rollback configurations exist, the software purges the last rollback configuration. In configuration mode, you enter commands that affect the configuration hierarchy. The configuration hierarchy stores configuration information and is independent of the CLI operational mode command hierarchy. The commands available in configuration mode are also independent of the commands available in operational mode. For example, operational mode includes a show command that displays specific operational information. While configuration mode provides a show command that displays the configuration hierarchy. The two commands are independent of each other. The software organizes the statement hierarchy in a tree structure similar to Windows folders or Unix directories, grouping related information into a particular branch of the tree. Use configuration mode set commands to modify the candidate configuration. Use the show command to display the candidate configuration. Both commands are relative to the current configuration hierarchy shown by the edit prompt. Configuration files use curly brackets and indentation to visually display the hierarchical structure of the configuration. Terminating or leaf statements in the configuration hierarchy are displayed with a trailing semicolon. You enter neither the curly brackets nor the semi-colons as part of the set command. To move down through an existing configuration statement hierarchy, or to create a new hierarchy and move down to that level, use the edit command, specifying your desired hierarchy level. After you issue an edit command, the configuration mode banner changes to indicate your current level in the hierarchy. To move up one level from the current position in the hierarchy, use the up command. To move up more than one level from the current position in the hierarchy, supply an optional count to the up command. The software moves you up the specified number of levels or to the top of the hierarchy if there are fewer levels than specified. The top command quickly moves you to the top of the configuration hierarchy. You can combine top with edit to move quickly to a different hierarchy, or with show to display the configuration details for a different hierarchy as in this example. This example illustrates how the exit command returns the user to the most recent higher level of the hierarchy. Entering exit at the top level of the hierarchy, exits configuration mode. Entering the exit configuration mode from any level of the hierarchy also enables you to exit the configuration mode, as in this example. You can quickly navigate between levels of the configuration hierarchy using the edit, up, top, and exit commands.