This question already has an answer here:

I have this recurring problem when I use screen with a USB-TTL cable to connect to a serial console (embedded linux device.) I can't seem to configure screen to handle my terminal height correctly. Pager apps like less, man and vim display in weird ways as soon as I start to scroll up.

I've tried numerous termcap settings in my .screenrc to no avail. I wonder if this has to do with TERM being set to vt102 instead of something like xterm. Changing TERM for the logged-in session does not seem to help.

Example screenshot below. Note the footer appears in the middle of the screen with duplicated output. ^L fixes it until the next time I scroll up again.

I'm on OSX using Mac's builtin Terminal.app.

Also, if I SSH into the same box everything works great. In this case TERM=xterm-256color but of course I am not using screen anymore either.

enter image description here

EDIT: regarding this being marked as a dupe: I tried the answers in the linked post, with the following result:

Calling resize gives me the following statusline message: resize: need more than one region.

As to manually setting the height, that's maybe a fine answer for the linked article but but I don't feel like it satisfies the request of how to do this automatically when the session is opened. I updated this post title to clarify.

Edit #2 (with solution)

This answer actually provides a working and automate-able solution. Seems I can't post an answer since this was flagged as a dupe.

marked as duplicate by Thomas Dickey, GAD3R, Mongrel, Julie Pelletier, G-Man Jan 21 '17 at 4:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    It's best not to have other people's personal information in the backgrounds to one's screenshots. – JdeBP Jan 20 '17 at 18:38
  • You got me, I forgot my terminal background is ever-so-slightly translucent and didn't notice with screen brightness/ contrast. Fixed. – thom_nic Jan 23 '17 at 15:54
  • MODS: please update the "this question has already been answered" banner to point to the post I referenced in my edit at the bottom! – thom_nic Feb 14 '17 at 15:32