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. ((Look for an upcoming post on screen fonts and some recommendations.))

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.

Other Posts in A Series On The Same Topic

  1. Cisco IOS CLI Regex: sh ip bgp in (2nd May 2012)
  2. IOS CLI Tip: More accurate pipe commands (1st May 2012)
  3. Cisco Nexus NXOS and Fixing broken “switchto” syntax with alias (18th December 2011)
  4. show ip eigrp topology all (22nd May 2011)
  5. Cisco IOS CLI Shortcuts (6th February 2011)
  6. The poor man's IOS Traffic Generator (19th September 2009)
  7. IOS: "terminal monitor" on, off - logging to your terminal (17th September 2009)
  8. IOS: Console, Terminal, Monitor, VTY - what is what ? (16th September 2009)
  9. IOS: Clearing an interface configuration (13th September 2009)
  10. IOS: Setting Terminal Window Length (10th September 2009)
  11. IOS CLI: show run linenum (9th September 2009)
  12. IOS: Setting the TCP timeout on IOS (14th August 2008)
  13. IOS: enable and .... disable ? (20th July 2008)
  14. IOS: Reverse SSH console access - Part 2 (25th June 2008)
  15. IOS:Open Source Lab DNS and IP addressing (2nd June 2008)
  16. IOS: Reverse SSH console access (29th May 2008)
  17. ip tcp timestamp (14th April 2008)
  18. Cisco ASA and IOS command tip - test aaa-server (18th February 2008)
About Greg Ferro

Greg Ferro is a Network Engineer/Architect, mostly focussed on Data Centre, Security Infrastructure, and recently Virtualization. He has over 20 years in IT, in wide range of employers working as a freelance consultant including Finance, Service Providers and Online Companies. He is CCIE#6920 and has a few ideas about the world, but not enough to really count.

He is a host on the Packet Pushers Podcast, blogger at EtherealMind.com and on Twitter @etherealmind and Google Plus

You can contact Greg via the site contact page.

  • http://blog.ioshints.info Ivan Pepelnjak

    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 :).

  • DDD

    Is there any way to output all info without having to hit the space bar for -more-. I just want all the data to output and the screen to scroll to the bottom.

    • http://etherealmind.com Etherealmind

      Hi

      Yes. Just set the terminal length to zero and it won’t stop.

      At the command line you should see this :

      Router(config-line)#length ?
      Number of lines on screen (0 for no pausing)

      Greg

    • DDD

      i got it, #terminal length 0

Subscribe For Weekly Updates by Email

Get a Weekly Summary of Latest Articles and Posts to your Email Inbox Every Sunday

Thanks for signing up. Look for the email from MailChimp & make sure you confirm your email address. You may need to check your spam or gmail settings to be sure of receiving the email.

Note: You can unsubscribe at any time using the link at the bottom of every email.