1

Is there any way to disable the behavior of gnu-screen, of issuing a clear at startup?

I'm using screen merely as a backstop, so that if disconnected, the session isn't HUP'ed. And I've got my shell (bash) config'd to "exec screen -A" on login, so that I get right into screen automatically.

However, screen immediately issues a clear and then I've got to scroll back up to see whatever login messages there might have been.

Similarly, at exit, I'd like to skip the clear there too, so I can see the results of my .bash_logout.

(If it's any help, my term is usually xterm-color (via Mac OS X's Terminal.app) though I do sometimes come in via ssh from some other node. And I'm generally connecting to an Ubuntu box/instance.)

2 Answers 2

1

Because screen takes over the entire screen, its not possible to have it leave the terminal buffer unprocessed. If you're interested in the motd specifically, you can always have your .bash_profile call cat /etc/motd, which would give you the same functionality.

Another option is to just call screen manually, which sounds like it might be the behaviour you want anyway--since you're not actively using the screens to do work. This is even further recommended if you're worried about having a compromised account--since the login screen also shows your last login location.

4
  • I do want screen to run automatically - so I don't have to remember to do so -- probably right after I get disconnected and remember I haven't. :/
    – mvgfr
    Mar 29, 2011 at 14:03
  • I'm already using "termcapinfo xterm*|xterms|xs|rxvt ti@:te@" (in .screenrc) to capture everything via my terminal buffer (vs. screen's), so I'm close; I just want to skip the clear at startup (and exit).
    – mvgfr
    Mar 29, 2011 at 14:06
  • BTW: Using screen seems the only way to automatically keep sessions active in case of disconnect - though I'm happy to be proven wrong here. This is the primary functionality I'm looking for.
    – mvgfr
    Mar 29, 2011 at 14:08
  • You can nohup and background the command, but once you logout with the session, you will never be able to bring it to the foreground, so make sure you pipe output to a file to be read later.
    – Andrew M.
    Mar 30, 2011 at 2:13
1

As mentioned by Redmumba, screen takes over the entire terminal so you can't have it take over the existing buffer and display.

What I have done is changed my .screenrc to display a status bar at the bottom of the terminal window, and trained my fingers to say screen -ADR if I don't see that status bar. That way you have a visual cue that you are in fact running screen, and a reflex that will start it for you before you start to do anything which might not survive accidental disconnecting.

(Also, if you have the current time being displayed in the screen status bar, this acts as a keep-alive signal that can prevent connections from disconnecting due to being idle too long.)

3
  • Right; I don't want it to take over the existing buffer - I'd actually prefer it do nothing at all to the buffer/display. :)
    – mvgfr
    Mar 31, 2011 at 12:20
  • I appreciate the other suggestions - though of course a fully automatic method is preferable.
    – mvgfr
    Mar 31, 2011 at 12:21
  • Perhaps screen isn't the right tool for what I'm looking for; I just want something that will by default leave my session open if there's a disconnection, so I can pick up where I left off.
    – mvgfr
    Mar 31, 2011 at 12:23

You must log in to answer this question.

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