Wednesday, September 12, 2012

Screen Surprise

A few days back, I lost reference to a Spark(http://www.spark-project.org/) job because my ssh session to the remote machine got disconnected. My colleague was surprised that I wasn't using screen. I was surprised at his surprise because I had heard of screen exactly once before that day. I had no idea it was that popular. I decided to give it a try today.

To my surprise screen was already installed on the remote machine I tried it on, it must be really popular after all. Having used it for just about 30 minutes I can see why it is so useful. Sounds like a must have tool. There is enough information about it on the web so I will just provide a few commands here:

# screen
Creates a new screen window

#screen -ls
Lists available screen windows

#screen -r
Connect to a screen window

Once in screen window you can do Ctrl-A d to detach from the screen, it keeps running in the background.

The most important use case for me is that even if my ssh session drops accidentally the screen session keeps running on the machine and I can reconnect to it on my next login.

No comments:

Post a Comment