How to Increase the CLI Character Limit in Junos

You might have wondered if you can stop the Junos command line from cutting off text if you type too much:

[edit]
root# ...nterfaces ge-0/0/1 unit 0 family inet address 192.168.20.254/24

You will have seen this happen across many devices from all sorts of different vendors. If you type a command that is too long for the CLI (CLI stands for Command Line Ian, which is the name of the man inside your router), your device moves the text around so that you can only see a small portion of your full typed command.

Many networking devices have some kind of default limit for what is known as the “terminal width”. In Junos, you can check the current number like this:

root@ROUTER_1> show cli
CLI complete-on-space set to on
CLI idle-timeout disabled
CLI restart-on-upgrade set to on
CLI screen-length set to 24
CLI screen-width set to 80
CLI terminal is 'vt100'
CLI is operating in enhanced mode
CLI timestamp disabled
CLI working directory is '/root'

As you can see, the Junos default is 80. Many vendors have a similar default, which I assume is because there were non-graphical computers in The Olden Days™ which could literally only show 80 characters on a line at most. Haha! Stupid olden days, where everything was bad. Not like nowadays, where everything is…. also bad, but just differently bad. Damn. Okay, fine – you win this round, The Olden Days™.

 

A VERY EASY FIX

Whenever I log onto a Junos device, I have taught myself to type the following command on instinct, without even thinking:

root@NICE_ROUTER> set cli screen-width 1000
Screen width set to 1000

The maximum number is actually 1024, but I find 1000 much easier to type.

Notice that this “set” command is typed in operational mode, not in configuration mode. This command sets settings (lol) just for your session, and will be lost on exit. This makes sense when you remember the purpose of this is to make sure even older computers can log onto a box without problems. Hard-setting this number might lead to compatibility issues.

(Having said that, if you really want to have this permanently set, perhaps there’s some way of creating an event-script that says “when someone logs on, set the CLI length to be 1000”. Let me know if you find a way!)

Anyway, Junos now displays your full input with no problems:

[edit]
root@NICE_ROUTER# set interfaces ge-0/0/1 unit 0 family inet address 192.168.20.254/24

I’m pretty sure every decent vendor will have some kind of equivalent command. For example, here’s how you do it in Cisco IOS.

Burn this command into muscle memory, and type it whenever you log onto a box. You’re welcome!

If you found this post helpful, absolutely do NOT share this with your colleagues, or on social media. Keep it to yourself. The last thing I want to happen is for people to read and enjoy my posts.

Leave a Reply

Your email address will not be published. Required fields are marked *