The screen command is a very powerful and useful command.
As you work with a cluster system you may notice that if you lose your
connection, or close the terminal you are working on, whatever you were doing
on the cluster is terminated (this is not true of jobs submitted to the
scheduling system, they are held separately and are not terminated if you log
out of the cluster). So if you were copying files and waiting for the process
to finish and accidentely close your terminal, the file copy is terminated and
you will have to restart it. is why the screen command is so
useful. After the ``screen terminal'' has
been activated, anything in that terminal stays running even if you log out.
Simple usage of the screen command is easy, however, it may
not be readily apparent that its active.
Example:
[jdpoisso@legio ~]$ screen <- Screen clears -> [jdpoisso@legio ~]$
The screen clears itself and it appears as if nothing happened. However, you
are now in the ``screen terminal'' which is
functionally equivalent to any other terminal, but in case the window is
closed, or you want to detach this terminal will instead remain active.
You may go ahead and use this terminal normally. If
youre waiting for something to complete you can
detach, which leaves the screen terminal active but
removes it from view and protects it in case of a connection loss. To
detach you must press
``<Ctrl-A>-D''
(this is a key sequence, press control(ctrl) then A while holding
control(ctrl) then release those keys and press D). If done properly
you will see this.
Example:
[detached] [jdpoisso@legio ~]$
To reattach or to bring up the screen terminal you need to invoke ``screen -r'' and this will show your screen terminal exactly where it left off.
Note: The screen terminal may be exited like any other terminal, by
using the ``exit'' command.
This destroys the screen terminal and exits the screen program.
Note: screen may not be installed by default on your cluster system. Ask
your system administrator to install it for you.