Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

CLI Environment Settings

date_range 22-Nov-23

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:

content_copy zoom_out_map
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
  logical-system       Set default logical system
  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
  tenant               Set default tenant
  terminal             Set terminal type
  timestamp            Timestamp CLI output
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:

content_copy zoom_out_map
user@host> show cli 
CLI screen length set to 24
CLI screen width set to 80
CLI complete-on-space set to on

Set the Terminal Type

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

content_copy zoom_out_map
user@host> set cli terminal terminal-type 

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

content_copy zoom_out_map
user@host> set cli prompt string 
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:

content_copy zoom_out_map
user@host> set cli directory directory 

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:

content_copy zoom_out_map
user@host> set cli timestamp [format time-date-format | disable]

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:

content_copy zoom_out_map
user@host> set cli idle-timeout timeout 

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:

content_copy zoom_out_map
user@host>set cli restart-on-upgrade off

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

content_copy zoom_out_map
user@host> set cli restart-on-upgrade on

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:

content_copy zoom_out_map
user@host> set cli complete-on-space off
Disabling complete-on-space
user@host> 

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

content_copy zoom_out_map
user@host> set cli complete-on-space on
Enabling complete-on-space
user@host>

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:

content_copy zoom_out_map
user@host> set cli screen-length length 

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:

content_copy zoom_out_map
user@host> set cli screen-width width 

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.

content_copy zoom_out_map
user@host> show configuration

...
                }
              }
          }
      }
  }
  fe-4/1/2 {
      description "FA4/1/2: mxxj1-mr6 (64.12.137.160/27) (T=bblan, bbmail, bbowmtc)";
      unit 0 {
          family inet {
              filter {
                  output 151mj;
              }
              address 64.12.137.187/27 {
                  vrrp-group 1 {      
                      virtual-address 64.12.137.189; 
---(more 18%)-----------------------------------------------------

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.
    content_copy zoom_out_map
    [edit system login]
    user@host# set class breadclass idle-timeout 10
    
  3. Include the configuration-breadcrumbs statement at the [edit system login class <class name>] hierarchy level.
    content_copy zoom_out_map
    [edit system login class breadclass]
    user@host# set configuration-breadcrumbs
    
  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.
    content_copy zoom_out_map
    [edit system login user user1]
    user@host# set class breadclass
    
  5. Commit the configuration.
    content_copy zoom_out_map
    [edit]
    user@host# commit
    

    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.

    content_copy zoom_out_map
    user1@host> show configuration
    
    ...
                    }
                  }
              }
          }
      }
      fe-4/1/2 {
          description "FA4/1/2: mxxj1-mr6 (64.12.137.160/27) (T=bblan, bbmail, bbowmtc)";
          unit 0 {
              family inet {
                  filter {
                      output 151mj;
                  }
                  address 64.12.137.187/27 {
                      vrrp-group 1 {      
                          virtual-address 64.12.137.189;
    ---(more 18%)---[groups main interfaces fe-4/1/2 unit 0 family inet address 64.12.137.187/27 vrrp-group 1]---

    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.

footer-navigation