Monthly Archives: July 2014

GNU screen Command

The screen utility can be used to start a session that will be persistent if the terminal is lost, plus it also provides the ability to login from another computer simply by attaching to the screen session name.

 
Here are some essential commands to know:

Start new session with a name and a log file

screen -S <name> -L

List running sessions

screen -ls

Attach to a running session

screen -r <name>

Detach

<ctl> a d

Detach, ReAttach/create

screen -d -R <name>

 
 
The “screen -S <name> -L” command will create a session with the specified name and also create a logfile with a naming convention of screenlog.<#>.
 
Once you have your session open, you can start a long running process, and then exit the session via the detach command.
 
When you are ready to reconnect, you can do so using the “screen -r <name>” command.  If you didn’t specify a name, or forgot the name, you can run the “screen -ls” to show a listing of the screen sessions.