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 (the network administrator) can customize the Junos OS CLI environment to suit your specific preferences and requirements.

Customize the CLI Environment

In operational mode, you can customize the 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:

Some values are already set 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.

Display the Current CLI Settings

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

Set 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.

Set 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 to user@host.

Set the CLI Directory

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

The directory must be the full pathname of the desired working directory. After entering this command, the CLI switches to the specified directory.

Set 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).

Set the Idle Timeout

By default, a CLI session never times out after extended idle time unless you have included the idle-timeout statement 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.

Set the CLI to Prompt for Restart After a Software Upgrade

By default, the CLI prompts users 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:

Set 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:

Set the CLI Screen Length and Width

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

Set the Screen Length

The default CLI screen length is 24 lines. If output is longer than this, the display scrolls to the configured screen length and then displays a more prompt. You can press Enter to display the next line, or press the Spacebar to show the next full screen. Alternatively, you can press h to view 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. This setting causes the screen to 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.

Set 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:

Enable Configuration Breadcrumbs

You can configure the output of show configuration operational mode commands and show configuration mode commands to display configuration breadcrumbs. These breadcrumbs help you identify the exact location in the configuration hierarchy for the output you are viewing.

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

The output does not clearly indicate the section of the configuration being viewed.

To enable the configuration breadcrumbs feature:

  1. Launch configuration mode in the CLI.
  2. Define a class at the [edit system login] hierarchy level, and set 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 breadcrumb output view when this user runs the show configuration operational mode command.
  5. Commit the configuration.

    Upon 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 the user is viewing. In this case, user1 is currently viewing the interface configuration of a group.

    Note:

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