using screen for long-running jobs

screen is a program that allows you to start a session and then detach from that session without killing the session. For example, you could start a job in a screen session, detach and log out, then log in to the same computer from home and reattach to that session.


SPINACH[~]$ screen
(shows screen splash screen)
SPINACH[~]$ ./findall.py
This program will calculate all known perfect numbers...

Perfect Numbers
-------------------------
1 ....is not perfect...
2 ....is not perfect...
3 ....is not perfect...
4 ....is not perfect...
5 ....is not perfect...
...
...
(hit Ctrl-a d)
[detached from 29395.pts-3.spinach]
SPINACH[~]$ exit

...3 hours later...

SPINACH[~]$ screen -r
38268 ....is not perfect...
38269 ....is not perfect...
38270 ....is not perfect...
38271 ....is not perfect...
38272 ....is not perfect...
38273 ....is not perfect...
...
...
SPINACH[~]$ Ctrl-d  
[screen is terminating]
SPINACH[~]$ 

Note: this is only useful for non-graphical programs, but some students were using xvfb and screen this last semester.