SSTS Blog

Some news and tidbits that we share

Viewing entries tagged Linux Subscribe to feed

Linux/Unix Screen command

by SSTS
SSTS
Server Side Technology Solutions is a consulting firm that specializes in databa
User is currently offline
on Tuesday, 17 January 2012
Blog 0 Comments

Recently, I went through a restore for a very large database that took several days to complete. I was literally tied to my shell and couldn't afford to sever my internet connection and was unable to leave the house. I new of a command called screen and had used it before. However, I was in crisis mode and couldn't review it's use at the time and had already started the recovery and didn't want to restart the process. Today I reviewed screen and know it will come in handy. Screen allows you to re-attach to a secure shell session after a connection failure. Since we do a lot of remote work connection failures occur all the time. For Windows, using Remote Desktop this isn't a big deal since you can re-attach. But, for Linux/Unix the work-around isn't as well known.

Basically, to start a screen session just type the screen command. This starts a new shell (sort of a facade) that can be re-attached to if you need to disconnect or if your connection suddenly goes away.

To re-attached you need to get the session identifier so you can re-attach. To see a list of sessions use screen -ls. This command will list screen sessions that can be attached to.

To attach to a screen session: screen -r

 

Tags: Linux