I run a screen session locally on my laptop. Within that screen session, I connect via ssh to a server on which I do most of my work. Since that connection gets reset sometimes (e.g. VPN timing out), I run a screen session on the server as well so that I can reconnect to it and have my shell exactly as it was.

So my workflow is: wake laptop, switch to terminal, find local screen session running but a message showing connection timed out, ssh to my server, run screen -x to reconnect to the screen session on the server, and do my work.

The ~/.screenrc file on the server just contains one line, altscreen on. Otherwise all my custom screen stuff (including customizing the meta-character to be Ctrl-Space, and having a status bar with window names) is on my laptop only. (I also have altscreen on in my laptop's .screenrc file.)

The upshot of this is that I can control the remote screen session using Ctrl-A (the default) and I can control the local screen session using Ctrl-Space. I don't normally control the remote screen session or do anything with it except connect to it—but that's where my question comes in.

Currently, if I try to scroll back on the remote server using Ctrl-Space+[, it doesn't work correctly. I may see the contents of previous Vim buffers I had open, or other stuff. To scroll back on the remote server, I have to use Ctrl-A+[.

How can I make it so I can scroll normally, i.e. using Ctrl-Space+[, and see the proper scrollback history for my shell on the remote server? In other words, I want to pretend that screen doesn't even exist on the remote server, since I want to use it ONLY for purposes of resuming my work where I left off before the connection was interrupted.

  • Why do you have a screen on the laptop?
    – Max Muster
    Commented Oct 16, 2020 at 19:34
  • @MaxMuster muscle memory for tab switching and scrollback copying. I could use iTerm tabs for separate tabs (i.e. a separate GUI tab for each shell/server I'm logging into), but I like having it all in screen. Also, unfortunately, I cannot ssh to all servers I need to from that main working server, so I have to ssh directly from my laptop for some things.
    – Wildcard
    Commented Oct 17, 2020 at 0:21
  • Are you 100% sure that you will never want to use Ctrl-Space+[ for your local screen session? In other words, are you prepared to sacrifice that keybinding and make it work only with the remote screen? Commented Aug 20, 2021 at 10:35

1 Answer 1


screen is a terminal emulator within another terminal. You can scroll back OK in the outer screen but if the application you run in it is something like screen or vim or another semi-graphic application which implements its screen rendering including scrolling by itself, and not using the terminal (here screen) scroll buffer, then there's nothing that terminal (here screen) can do about it.

It's the same thing if you run screen within xterm for instance. You can't use xterm's scrollbar anymore.

You'll notice that when you reattach the remote screen, you see the contents of the remote screen terminal screen and you get access to its scrollback buffer (by interacting with that screen).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .