Whenever I reattach to my detached screen (containing Irssi), my Putty screen is resized to something it has been at startup. If I change the window size after this, detach the screen and resize it back, window will be again resized to the original size. By window I mean the Putty window on my windows box. How can I turn this feature off?

Using Windows XP as my local and CentOS 6.0 as the remote OS. Putty 0.61.


You can also prevent screen from resizing any remote sessions. The other answer prevents this in your one local putty installation - but what if you come to another workstation?

Anyway, to prevent screen from resizing xterms, you need to:

  • Edit /etc/screenrc
  • Find this this bit of text

# Long time I had this in my private screenrc file. But many people
# seem to want it (jw):
# we do not want the width to change to 80 characters on startup:
# on suns, /etc/termcap has :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:

#termcap xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
#terminfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'

  • Uncomment those two termcap lines and screen will behave from now on.

I just ran into this problem, googled, found the answer here, tested and thought it might be useful for others.

Note that if you are unable or do not want to edit the global screenrc configuration, ~/.screenrc will do just fine for your current user.

  • I'd be tempted to mark this as the accepted answer but it seems I'm unable to test it as the behaviour went away... Have to upvote at least though :) – eis Aug 18 '12 at 6:38
  • 1
    Yes! managed to test it now and works exactly like described. – eis Aug 18 '12 at 6:41
  • glad it worked for ya :) – Zlatko Aug 18 '12 at 9:49
  • pmodin's comment on the original site fixed this answer in my case: I had to set it as "xterm*" as my putty configuration uses xterm-color as TERM. – Mikuz May 22 '14 at 6:05
  • not working for me. cant get to resize, using 4.02.01 im also trying to launch with screen -AR, or any combo of screen -Ar, and initial launch with screen works fine, and intial launch of screen -A works fine, any detachment breaks it. also have this on .screenrc which is supposed to fake it, and no go. escape ^a followed by bindkey ^ad detach – Brian Thomas Mar 19 '16 at 3:18

Found the answer. The feature is called "remote terminal resizing", and it can be disabled at Configuration -> Terminal -> Features -> Disable remote-controlled terminal resizing, as described in PuTTY configuration.

Don't really know why reattaching screen does window resize remote request, though.

  • 1
    This worked well for me. I have a termcapinfo line in my .screenrc that forwards the scrollback buffer. I don't understand how the termcapinfo line is parsed and don't want to mess with it. – Morphit Dec 8 '13 at 17:01

The accepted answer lacks an explanation for the phenomena. Here is one:

  • The long string for is is an initialization string for the terminal, which usually is the same as rs (used by reset).
  • The example given contains a control sequence which resets the terminal from 132 to 80 columns. Just that part is the "3" in \E[?1;3;4;6l, which could be split up into four controls. The one that affects the width is \E[?3l (see XTerm Control Sequences for "132 Column Mode (DECCOLM)").
  • That happens to be a VT100 sequence, which was used in the X11R5 xterm terminal description.
  • When screen starts (or attaches), it initializes the terminal, just in case. That changes the terminal's width.
  • CentOS 6 is a little old now; the current upstream xterm description has used a shorter sequence for quite a while, which initializes more things.
  • The newer/shorter sequence looks like this: is2=\E[!p\E[?3;4l\E[4l\E> (defined in xterm-basic). The \E[!p part is DECSTR, which resets character sets, color and video attributes. The older sequence did not do that; telling screen to use it works, but is not as clean.
  • If you use a different TERM setting, then the customization in .screenrc will have no effect (because it uses TERM to match the particular setting).
  • In particular, if you use something like xterm-256color, you may notice the same behavior again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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