Keep ssh-scripts running without a connection - "screen" for Linux

Reading time ~1 minute

I started offloading some of the heavy-lifting and the more time-consuming jobs to my server. While I am more and more comfortable of using the ssh terminal, the mayor problem was that scripts only worked as long as I was logged in. Which goes completely against the whole idea of laying off work to the server. After some goggling I found the small tool “screen” which is available for linux. A more comprehensive introduction can be found here, but after installing I only used three commands: “screen” to start; “screen -ls” to list the open terminals after reconnection, and “screen -r XXX” to reconnect to a running terminal.

Installation

With my Linux (ubuntu) server all I had to do to install it was a simple $ sudo apt-get install screen

Use

After that you can start screen by simply typing: $ screen

Now start your time-consuming job and just quit the terminal whenever you can’t stand waiting any longer. Whenever you want to have a look again just connect via ssh, and get a list of open screens:

$ screen -ls

this gave me: 3467.pts-0.MYSERVER (09/14/2011 08:59:46 PM) (Detached) 2238.pts-0.MYSERVER (09/14/2011 08:45:13 PM) (Attached) 2 Sockets in /var/run/screen/S-gerhi.

To reconnect to the first of these still running terminals, you just enter: $ screen -r 3467.pts-0.MYSERVER

The world is flat F(1,18) = 39.200; p = .335 - or p < .01 or p <.001? - Check your stats!

A reviewers dream has come true. The new __statcheck__-package for [R](r-project.org) automagically checks the accurate __reporting__ of ...… Continue reading

Publication-lists-4-Your-Website

Published on June 19, 2015

Relaunch on Jekyll

Published on June 04, 2015