running long jobs using screen

The screen command allows you to start a screen session, run something in the session, then detatch from the session (even log out), and whatever you are running in the session keeps going. You can even log out, go home, log in later, and then reattach to the session to check your progress.

To start a screen session:

screen

This will show a screen splash page. Just hit Return to keep going. You are now in the started screen session (although the terminal looks the same).

At this point, start your long job:

python3 longJob.py

Or you may want to save the output of your job into an output file:

python3 longJob.py >> output.txt

Now you can detach from the screen session

Ctrl-a d

That means hold down Ctrl and hit a, then let up on both and hit d.

You are now detached from the session free to log out.

Later, when you want to re-attach, just log in to the original machine and run:

screen -r

When done, you can exit a screen session with exit.


See also:


Back to SwatCS Help Docs