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 control the Junos OS command-line interface (CLI) environment and change the default CLI environment according to your specific requirements. For more information, see the following topics:

Controlling the Junos OS CLI Environment

In operational mode, you can control the Junos OS command-line interface (CLI) environment. For example, you can specify the number of lines that are displayed on the screen or your terminal type. The following output lists the options that you can use to control the CLI environment:

user@host>set cli ?
Note

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

This chapter discusses the following topics:

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 (" " ).

Setting the CLI Directory

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

The directory is the pathname of working 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:

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

Setting the Idle Timeout

By default, an individual CLI session never times out after extended times, 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 router, use the set cli idle-timeout command:

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

Setting the CLI to Prompt After a Software Upgrade

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

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

Setting Command Completion

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

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

To reenable the use of both spaces and tabs for command completion, use the set cli complete-on-space on command:

Displaying CLI Settings

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

Setting the Junos OS CLI Screen Length and Width

You can set the Junos OS command-line interface (CLI) screen length and width according to your specific requirements. This topic contains the following sections:

Setting the Screen Length

The default CLI screen length is 24 lines. To change the length, use the set cli screen-length command:

Setting the screen length to 0 lines disables the display of output, one screen at a time. 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. To change the width, use the set cli screen-width command:

Note

In Junos OS Release 13.2 and earlier,width can be 0 through 1024.

Example: Controlling the CLI Environment

The following example shows you how to change the default CLI environment.

Changing the CLI environment is all about customizing the CLI window to fit your personal preferences. Use the settings discussed in this topic to make the CLI window look and behave according to what you find most convenient and efficient.

Requirements

No special configuration beyond device initialization is required before configuring this example.

Before starting this example, check what the default settings are. Use the show cli operational mode command.

user@host> show cli

Is the prompt set to your username@routername? If not, exit the CLI and enter the operational mode again.

Is the CLI screen length set to 66 and the CLI screen width set to 80? If so, you can start the example. Otherwise, make these changes to the CLI settings:

Overview

To see a list of CLI environmental settings that you can change, use the set cli ? command.

user@host> set cli ?

This example focuses on three of these commands: set cli screen-length, set cli screen-width, and set cli prompt.

Configuration

This configuration example has the following sections:

CLI Quick Configuration

To quickly configure this example, copy the following commands and paste them in a text file, remove any line breaks, change the values used to match your network configuration, and then copy and paste the commands into the CLI at the operational command prompt.

Configuring the CLI Prompt

Step-by-Step Procedure

The default CLI prompt is your username@hostname. But you can have any prompt you find useful.

To configure a different CLI prompt:

  • Use the following operational mode command where string is the exact text you want to see at the command line.

    For example, if “string” is “router1-san-jose> “, the command is as follows:

Configuring CLI Width

Step-by-Step Procedure

How do you know what width works best for you? This example discusses how CLI width can affect what you see.

To configure a new default CLI width:

  1. See what the current defaults are for the CLI environment.
  2. Examine the following output for the operational command show class-of-service forwarding-class.

    The output from this command is wider than some and so illustrates a common problem with viewing output. If, for example, you have a relatively narrow window, command output might be displayed in overrun lines.

    router1-san-jose> show class-of-service forwarding-class

    The lines look to be intermingled and it is hard to read across to find the information you might be seeking.

  3. Change the window width to 110 columns. Notice how the output of this command is much easier to read in the wider format.
    router1-san-jose> show class-of-service forwarding-class

Step-by-Step Procedure

Configuring CLI Length

Step-by-Step Procedure

You can set the length of the CLI screen the same way you set the width. To configure a new default CLI length:

  1. See what the current defaults are for the CLI environment.
  2. Examine the output for the operational command show version.

    The current length is 66 lines, which is close to the length of a typical monitor. But even though the output is long, it does not need all that space to be clearly seen in its entirety. In fact, it is harder to pick out just where the output starts in a screen this long.

  3. Change the window width to 45 lines.
  4. Now examine the output again.
    router1-san-jose> show version

    With a shorter screen, you can easily see where the current output begins and ends.

Return to the Default CLI Prompt

Step-by-Step Procedure

To go back to the default prompt:

  1. Exit the CLI.
  2. Enter the CLI operational mode again.

Example: Enabling Configuration Breadcrumbs

The output of show configuration operational mode command and show configuration mode commands can be configured to display configuration breadcrumbs that indicate the exact location in the hierarchy of the output being viewed.

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

user@host> show configuration

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

To enable the configuration breadcrumbs feature:

  1. Define a class at the [edit system login] hierarchy level.
  2. Add a user to the defined login class to enable the breadcrumbs output view when this user enters the show configuration operational mode command.
  3. Configure the configuration-breadcrumbs statement at the [edit system login class <class name>] hierarchy level.
  4. Confirm 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.

    user1@host> show configuration

    The new output indicates the exact location of the configuration hierarchy being viewed. User1 is currently viewing the interface configuration of a group.

    Note

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

See also

Release History Table
Release
Description
In Junos OS Release 13.2 and earlier,width can be 0 through 1024.