2 September 2010

IOS: Setting Terminal Window Length

Some Roots

Cisco IOS has it’s roots in some very old technologies. As such, it tends to have some funny ideas about things if you are new to using Cisco IOS. When you telnet / SSH to a router, it always displays the configuration with 80 characters left to right, and 24 lines of characters from top to bottom. This goes to back to the olden days of character based terminals and the BSD of the day.

Wyse 50 serial console terminal (Credit:Wikipedia)

Wyse 50 serial console terminal - ahh memories! (Credit:Wikipedia)

Console or Terminal

I use the word terminal and console as separate terms.

Console describes the serial port on your router
Terminal describes a telnet or SSH session to your router
Terminal Emulator Software package that emulates a terminal (such as that above) and can be used to connect to the Console (with a serial cable) or make a telnet / SSH connection.

Since you can “console or terminal” to a router, it’s typical for most engineers to say “console or session” to the router.

24 lines is NOT enough

When you are constantly typing ‘show run’ to get the config on your Cisco console / terminal  you might notice that only 24 lines are shown before you need to press space to make it continue:

Terminal Session is only 24 lines long - aaarrgh

Terminal Session is only 24 lines long - aaarrgh

If you spend a lot of time at the console, like me, you might find this a bit annoying. A modern computer with a small but readable font can easily get sixty or more lines.

Adjust your Terminal

The Cisco IOS console has a couple of switches that you use to fix this.

Terminal Length – Temporary

For the current console session you can simply type

term len 60

and for the remainder of the session that you are logged in, the window will always display sixty lines.

60 lines of Glorious Viewing Pleasure

60 lines of Glorious Viewing Pleasure

TIP:Best Starting Length

For most terminal programs (Putty, SecureCRT etc) a good starting length is 40 lines. This is because the default screen fonts used on Windows and Linux tend to work out to forty lines for a full length screen.1

Best of use of terminal length ?

The very best use of terminal length is when you want to dump a whole pile of information to your screen. You might want to copy it into a text file to send to me to analyse, or save the configuration and some show commands for future reference. But you don’t want to have to keep pressing the space bar over and over.

terminal length 0

and to set it it back

terminal length 40

Terminal Length – Permanent

If you want to set this to a default for every future IOS terminal session then do the following:

Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#line vty 04
Router(config-line)#len
Router(config-line)#length ?
<0-512> Number of lines on screen (0 for no pausing)

Router(config-line)#length 40

Checking the Configured Terminal Length

Router#sh terminal
Line 0, Location: “”, Type: “”
Length: 0 lines, Width: 80 columns
Status: PSI Enabled, Ready, Active, Automore On
Capabilities: none
Modem state: Ready

—-SNIP—-

No special data dispatching characters
Router#

Should you do this ?

Setting the terminal length to forty lines is probably acceptable in most networks but not longer. You can’t always be sure what terminal emulator you might use in an emergency so keep it smaller rather than larger.

Console – should you set it ?

Note that the console permanent settings is slightly different. I would recommend against this. The console is your emergency connection and you really want it to work.

Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#line console 0
Router(config-line)#leng
Router(config-line)#length ?
<0-512> Number of lines on screen (0 for no pausing)

Router(config-line)#length

Wrap Up

I will continue to post more articles in a series on Console Mastery over the next few weeks since there has been a hot response to the last few. If you have any tips you want to see here, don’t hesitate to leave a comment or email me: myetherealmind —at– gmail dot com – I’m sure that there are really clever people out there who know stuff that I don’t.

Footnotes

  1. Look for an upcoming post on screen fonts and some recommendations. [back]

Please rate this post:

1 Star - It\\\'s Crud2 Stars - It\\\'s Tosh3 Stars - Something\\\'s missing4 Stars - Needs works5 Stars - Good Enough6 Stars - Good7 Stars - Excellent8 Stars - Brilliant9 Stars - Astonishing10 Stars - Awesomely Godlike? (1 votes, average: 5.00 out of 10)
Loading ... Loading ...

About Greg Ferro
Greg is a Network and Security Architect / Designer / Engineer working freelance in the UK and worked for Resellers, DotCom's, Large Corporate's and Service Providers across a variety of products & Vendors. He prefers to work for end users, believes in the life cycle, total cost of ownership and that near enough is often good enough. He likes talking about himself in the first person to feel "royal", even when hosting the Packet Pushers Podcast on Data Networking. More about Greg at http://etherealmind.com/who-am-i/ and you can follow him on Twitter.

Comments

  1. You could also use

    puts [exec "command"]

    in tclsh to work around pagination. The ultimate hack is probably a tclsh script that you run through an alias :) .

Speak Your Mind

*