If you do some time-consuming, additional computing on your Linux server this tool could be very useful for you.

I often start a python script on my server. This algorithm approximately  needs 5-6 hours to finish. My terminal window is blocked during this  time and I can't turn off my computer.

With screen, you can switch between multiple terminals in just one window. It is also possible to close this window.

How can I install this tool?

Simply install screen with:

yum install screen

The command screen -list will display all available screens. To start a new screen just execute screen.As  you can see in the following output, every screen gets a new number.  This gets tricky, if you have multiple screens available.

There are screens on:
        2843.pts-0    (Detached)
        2817.pts-0    (Detached)
2 Sockets in /var/run/screen/S-root.

The best way is to use screen -S NAME to identify each screen.

To close one screen completely, the normal exit command will do this for you. If you just want to switch back to your original terminal you have to press CTRL A D (hold CTRL, press A, release A, press D)

Resuming can be done with screen -r NAME.

If you also have the problem that you can not connect to a screen, because the screen is already attached, visit this post.

Please comment below, if you have any questions.

Tested on:

  • OS: CentOS 7
  • Screen 4.01.00devel