Screen

Quick tutorial on how to use screen

Quite often, bioinformatics analyses take ages to run. This makes it difficult if you are running thing on the command-line and want to shut down your computer without the program being terminated. Luckily there are a few solutions to this, the one I have been using recently is called screen. This program allows you to open a "screen session" on your terminal, run software and most importantly, detatch it from the terminal. You can then re-attach it on a different terminal later. Here are a few pointers to get you going.

  1. To start a session just type screen in to the terminal. Depending on the OS, it might print the version information and ask you to press any key to continue. Now it should look like a normal terminal with one exception, you can't scroll up. Everything else is pretty much the same.

  2. Now you can run the program you want in the same way you normally do

  3. Once you have started running your program, you can detach the screen session by pressing and holding the keys Ctrl + a + d. It should show some like[detached] on your terminal.

  4. You can re-attach the session by opening a terminal (or using the same one) and running screen -r. If you have started multiple screen session you might have to specify a number like screen -r 15625.pts-0.plum-p2. Each session has a unique code and they will be printed to the screen if you run screen -r and there are multiple sessions.

That is just a really quick intro, there is so much more you can do with screen like open multiple tabs in the same sessions but this should be enough to get you going.

Last updated