Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

CLI Environment Settings

In operational mode, you can customize the Junos OS command-line interface (CLI) environment to suit your specific preferences and requirements.

Customizing the Junos OS CLI Environment

In operational mode, you can customize the Junos OS CLI environment by using the set cli command. For example, you can specify the number of lines that are displayed on the screen or your terminal type. The following output lists the available options:

Note:

When you use SSH to log in to the device or log in from the console when its terminal type is already configured , your terminal type, screen length, and screen width are already set.

Displaying the Current CLI Settings

To display the current CLI settings, use the show cli command:

Setting the Terminal Type

To set the terminal type, use the set cli terminal command:

The terminal type can be one of the following: ansi, vt100, small-xterm, or xterm.

Setting the CLI Prompt

The default CLI prompt is user@host>. To change this prompt, use the set cli prompt command. If the prompt string contains spaces, enclose the string in quotation marks (" " ).

Note:

Changing the CLI prompt is not persistent across CLI sessions. When you exit the CLI and restart it, the prompt defaults back to user@host.

Setting the CLI Directory

To set the current working directory, use the set cli directory command:

The directory should be the full pathname of desired working directory. After entering this command, the CLI will switch to the specified directory.

Setting the CLI Timestamp

By default, CLI output does not include a timestamp. To include a timestamp in CLI output, use the set cli timestamp command:

Enclose the format in single quotation marks ( ‘). If you do not specify a timestamp format, the default format is 'Mmm dd hh:mm:ss’ (for example, Feb 08 17:20:49).

Setting the Idle Timeout

By default, a CLI session never times out after extended idle time, unless the idle-timeout statement has been included in the user’s login class configuration. To set the maximum time an individual session can be idle before the user is logged off the device, use the set cli idle-timeout command:

The timeout can be 0 through 100,000 minutes. Setting the timeout to 0 disables the idle timeout.

Setting the CLI to Prompt for Restart After a Software Upgrade

By default, the CLI prompts you to restart after a software upgrade. To disable the prompt, use the set cli restart-on-upgrade off command:

To reenable the prompt, use the set cli restart-on-upgrade on command:

Setting CLI Command Completion

By default, you can press Tab or the spacebar to have the CLI complete a command.

To have the CLI allow only Tab to complete a command, use the set cli complete-on-space off command:

To enable the use of the spacebar (as well as Tab) for command completion, use the set cli complete-on-space on command:

Setting the Junos OS CLI Screen Length and Width

You can set the Junos OS CLI screen length and width according to your specific preferences and requirements.

Setting the Screen Length

The default CLI screen length is 24 lines. If output is longer than this, the display will scroll to the configured screen length, then display a more prompt. You can press Enter to display the next line, or the Spacebar to show the next full screen. Alternatively, you can press h for all the available options, which include navigation, searching, and saving.

To change the screen length, use the set cli screen-length command:

Setting the screen length to 0 lines disables the use of “one screen at a time” output, so that it will scroll all the way through to completion without displaying the more prompt. Disabling this UNIX more-type interface can be useful when you are issuing CLI commands from scripts.

Setting the Screen Width

The value of CLI screen width can be 0 or in the range of 40 through 1024. The default CLI screen width is 80 characters. Using a CLI screen width value of 0 disables the display of the output screen, which may be desirable when using scripts. To change the width, use the set cli screen-width command:

Enabling Configuration Breadcrumbs

You can configure the output of show configuration operational mode command and show configuration mode commands to display configuration breadcrumbs. These breadcrumbs help you to know the exact location in the configuration hierarchy for the output being viewed.

Before enabling the configuration breadcrumbs feature, check the output of the show configuration command.

In the output, there is no clear indication about the section of the configuration being viewed.

To enable the configuration breadcrumbs feature:

  1. If not there already, go to configuration mode in the CLI.
  2. Define a class at the [edit system login] hierarchy level. Here, we are also setting an idle timeout value of 10 minutes.
  3. Include the configuration-breadcrumbs statement at the [edit system login class <class name>] hierarchy level.
  4. Add a user to the defined login class to enable the breadcrumbs output view when this user runs the show configuration operational mode command.
  5. Commit the configuration.

    On enabling configuration breadcrumbs in the CLI, user1 (the user added to the login class) can verify the feature in the output by entering the show configuration command.

    The new output indicates the exact location of the configuration hierarchy being viewed. In this case, user1 is currently viewing the interface configuration of a group.

    Note:

    If you are enabling configuration breadcrumbs for your own user account, log out and log in again to see the changes.