9

Connecting from Windows to Linux (CentOS 5.4) using PuTTY. Console set at 140col 60 lines. Not much else changed from default.

Connection is via serial cable to the box.

On Linux, installed and ran screen. Lines appear capped at 24 or so, cols at 80-ish.

Tried 'Ctrl-A :height -w' and it gave me a message along the lines of my terminal doesn't know how to change the height.

How can I make screen use the existing console size, or, resize screen once started?

Jon
  • 495
  • 1
    I had a similar problem with serial console terminals, where vim and other programs wouldn't use the actual size. I ended up using this python script: https://github.com/akkana/scripts/blob/master/termsize. I can't remember how I found it, though. Also related: http://compgroups.net/comp.terminals/putty-resize-action/2993350 – muru Dec 08 '14 at 18:24

2 Answers2

8

When you start a virtual terminal connected to something like an X terminal emulator or an SSH session, the terminal size is configured for you (e.g. forwarded over SSH from your local terminal). As you've discovered, when connecting over a raw serial port, this does not happen.

Option 1: just run

resize

This command will attempt to discover the size of your terminal using terminal emulation escape codes. It will configure the local terminal to match. Normally this is all you have to do.

Option 2: set your terminal size manually using:

stty rows <N> cols <M>
Celada
  • 44,132
  • Calling resize gives me the following statusline message: resize: need more than one region is there any way to make this happen automatically? ^a i (info) shows the correct lines and cols so I don't understand why it's not drawing correctly. Only other clue: echo $TERM gives vt102 – thom_nic Jan 23 '17 at 16:45
  • Update: I see resize is part of the xterm package which is not installed on my distro. Found solution here. – thom_nic Jan 23 '17 at 17:32
2

I just had a problem similar to this. When I reattach to the screen like below, it works for me. Otherwise try stty as stated above.

screen -A -h 500 -r 16238.pts-11.myhost2
UDude
  • 159