Sunday, March 14, 2004

Stable sessions

I'd heard about the screen command before, but I didn't really grok it until I read a recent article at kuro5hin.org. I knew that it enables multiple virtual terminals across a single telnet/ssh connection. That's nice, but I do the same thing when I open an ssh connection, launch emacs, then spawn multiple shells within emacs. The nifty thing about screen is that it decouples the telnet/ssh connection from the virtual terminals. Examples of how this can be useful include:
  • I can start a big nasty update in an Oracle sqlplus session shortly before I leave work, go home, reconnect to the screen session, monitor and commit from the same sqlplus session.
  • If I'm on an ssh connection that is apt to disconnect because of noisy phone lines or a weak wireless connection, I can continue where I left off every time I reconnect.
If you are an emacs user and don't already know about emacs' ability to save sessions, you're missing out. It won't preserve any shells or other processes running within emacs, but it will restore the "buffers, major modes, buffer positions, and so on that the previous Emacs session had." Never to be outdone by emacs, it seems that vim can also save session information.

No comments: