#StackBounty: #gnu-screen #remote #terminal-emulator #scrolling How to scroll screen within screen with the outer screen keybindings?

Bounty: 150

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.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.