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:
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
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
- Set the Terminal Type
- Set the CLI Prompt
- Set the CLI Directory
- Set the CLI Timestamp
- Set the Idle Timeout
- Set the CLI to Prompt for Restart After a Software Upgrade
- Set CLI Command Completion
Display the Current CLI Settings
To display the current CLI settings, use the show cli
command:
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:
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 (" " ).
user@host> set cli prompt string
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:
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:
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:
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:
user@host>set cli restart-on-upgrade off
To reenable the prompt, use the set cli restart-on-upgrade on
command:
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:
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:
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:
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:
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.
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: