Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

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 ?
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
  terminal             Set terminal type
  timestamp            Timestamp CLI output

Note: When you use SSH to log in to the router or log in from the console when its terminal type is already configured (as described in the Junos OS System Basics Configuration Guide), 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:

user@host> set cli terminal terminal-type

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

user@host> set cli prompt string

Setting the CLI Directory

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

user@host> set cli directory directory

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:

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

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:

user@host> set cli idle-timeout timeout

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 the Spacebar 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:

user@host> set cli complete-on-space offDisabling complete-on-spaceuser@host>

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

user@host> set cli complete-on-space onEnabling complete-on-spaceuser@host>

Displaying CLI Settings

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

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

Published: 2013-01-15