A screen/shell server is awesome!
My use of GNU Screen is as follows: I have a dedicated screen server inside the company intranet from which I connect (SSH) to all the other servers (which is only 6 at this point in time). I also SSH out to two mail servers run by the operations team. Lastly I have 2 SSH connections outgoing to my personal servers (including the one that runs this site).
Why a dedicated server? Well, that’s easy. The real power in screen is the ability to detach and reattach. If you shut down/crash your laptop, the screen session on the server will not be lost (unlike if you did it from your laptop, in which case it would be lost). Additionally, your server will (hopefully) have an always on connection so that the SSH connections will stay connected (theoretically forever). Better yet, you can reconnect to that screen server from anywhere AND you can even force “steal” a session.
If I leave screen running on my laptop at work and find myself needing to work on something on the road, I fire up Better Terminal Emulator Pro on my Xoom tablet and reconnect to the screen/shell server then forcibly steal the session. This saves me a massive amount of effort (because typing on tablet is bad enough, using symbols make it far worse), always allows me to connect, and is much more secure as the servers require SSH keys (which I’m not about to go leaving on a tablet). Once I get home, I can connect again via PuTTY to finish any lingering emergency work.
Using screen is super easy, but I wanted to share a few commands for the uninformed to make it even faster for them to get started:
screen — (From CLI) Launch screen
screen -r — (From CLI) Reattach a session locally
screen -Dr — (From CLI) Detach the session & reattach it locally
screen -Dr — (From CLI) List any screen sessions & their status
Ctrl+a a — Creates a new window and switch to it
Ctrl+a n — Switch to the next window
Ctrl+a p — Switch the previous window
Ctrl+a 0…9 — Switch to window # whatever
Ctrl+a " — List all the screen windows and allow you to switch to them
Ctrl+a d — Disconnect from screen This is, of course, by no means an exhaustive list of options. These are the most common commands that I use (as being fairly new to screen), as such you’re likely to need them as well. I’d also like to point out Ryan Lane’s post on shell servers which is what originally inspired me to do the same. He also lists some useful tips for configuring your .screenrc and .bashrc files to make your server just that much easier to use (I love the forces server name titles).