Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to force GNU screen to reflow to the existing terminal width when I reattach a session. It seems to me this worked properly before I upgraded a machine to CentOS 6, but I cannot figure out how to restore it. (TERM=xterm)

Whenever I reattach a session, regardless of state when I detached it, it launches at 80 columns, resizing my terminal (PuTTY, in this case) along with it.

I'm launching & reattaching with:

screen -aA -R <session>

My .screenrc contains only the following, and a few irrelevant key bindings:

term xterm

defscrollback 10000

# status line at the bottom
hardstatus on
hardstatus alwayslastline
hardstatus string "${-}%{.0c}%-w%{.y0}%f%n %t%{-}%+w %=%{..G}[%H] %{..Y} %D %M %d, %Y %c | Load: %l"
caption splitonly "%{.yK}%3n t"
caption string "%{.c0}%3n %t"

vbell off

# Fix fullscreen programs
altscreen on
share|improve this question
You might have better luck with tmux, I can dynamically resize my Terminal window and the tmux inside will follow. – number5 Nov 13 '13 at 23:15
up vote 23 down vote accepted

after you reattach a ctrl-a F runs the "fit" command to resize the current window. if you reattach using the -A option it should resize all windows when you reattach. Are there others still attached to the screen session when you are attaching? For instance, are you having to use -x to reattach instead of -r? you can detach others when you reattach with "screen -D -r" instead of "screen -x", and I'd expect this to automatically refit windows.

share|improve this answer
I am launching with -a -A, and no one else is attached. – Michael Dec 13 '11 at 15:49
This is still a problem with screen via Ubuntu 14.04. Fit doesn't work. Disconnecting and reconnecting does. Screen 4.2.1 is available from trusty backports. See the user backports documentation for information on enabling and using packages from the backports repository. – Greg Bell Oct 26 '15 at 10:24
Even after doing this, I had to resize my terminal window to send whatever signal screen needed to actually do the resize. – krs013 Oct 29 '15 at 3:25

Try adding this (from /etc/screenrc) to your ~/.screenrc:

# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
# (This fixes the "Aborted because of window size change" konsole symptoms found
#  in bug #134198)
termcapinfo xterm* 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'


share|improve this answer
In MPutty this definitively solves putty session not filling the entire page but opening too small – Thomas8 Dec 3 '15 at 20:37

Note that this answer only applies to PuTTY. I too am forced to use an operating system that I would rather not, and PuTTY is the only real option due to other restrictions on the system. I was having the same issue, my screen would resize upon initiating or connecting to an existing screen session. I tried the answers here to no avail (Windows 10 with PuTTY 0.67 installed via MSI). These answeres might have worked with a standard UN*X terminal, but not with PuTTY, it's a different beastie.

I went digging in the options, and lo and behold under "Terminal -> Features" there is an option labeled "Disable remote-controlled terminal resizing". Check the box, apply the setting, and try screen again. I think you'll find the problem resolved.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.