[auton-users] using screen

Dan Pelleg dpelleg+ at cs.cmu.edu
Fri Mar 21 11:33:23 EST 2003


screen is a great little utility to help you check up on long-running
jobs. For example, you can start a long experiment while in the office. You
can then log in from home and check up on it. If you're thinking "duh,
detached jobs", then screen will surprise you because it also works with
interactive processes.

EXAMPLE:
 
 from the office, you log into (say) loki and start your job, the job
generates output for 3 hours, then stops to ask you a question. But you're
out of the office by then...

 ...in the evening, from home, you log into loki, inspect the output, see
the question, and reply to it so the job keeps on running


END IMPRESSIVE EXAMPLE


How do you use it? Before starting your job, type "screen". It will show a
welcome message and then will look just like your shell again. If this is
not the first time you're using screen, it will not even show the message
so it would appear you're exactly where you left off. But this is not
true. You are, in fact, in an alternate universe where all your keystrokes
and all program output is captured. Well, in light of the PATRIOT act maybe
this universe is not that different, but the point is that it is processed
by screen.

After you have started your job, you can make the screen shell disappear
and get your normal shell back (the job will keep on running "in it"). Just
type C-a d (CTRL+A, then "d").

Then, from home, log into loki and type "screen -r". You will see the
output from the job and will be able to interact with it.

If you forgot to quit ("detach") from the first session, you can still
"steal" it later by doing a "screen -D".


Screen also support multiple "windows" (much like the ones your window
manager gives you, but not using any graphics - this is good if you find
yourself using old dialup software). It can alert you when any new output
is sent to any window, so it's also good to keep track of several jobs
without cluttering your display (for example, one of the windows can be an
IRC client or a long-running job).

It's also a nice way to keep a network-connected process (eg, a text-based
mailer or, er, an IRC client) open and active, and check up on it
periodically from different locations or across reboots of your laptop
(screen won't survive a reboot - it will need to run on a machine that
stays up the whole time).

All in all, an extremely useful tool. More than once I've slapped my
forehead about not having started a job under screen. Well now, you can
too.

-- 

  Dan Pelleg



More information about the Autonlab-users mailing list