Linux: Using “Screen” command

This is a very useful tool I only discovered today.

Screen is a full-screen window manager that allows you to manage multiple shell sessions from one terminal window or console, view multiple shell sessions at the same time, and even log into the same session from more than one location at a time.

In my case, I used Screen to create a new session for the purpose of starting an 11 gigabyte download – but was then able to shutdown my laptop and go home, without the download being cancelled. I was then able to resume this session later and confirm that the download had completed successfully.

To use:

  1. If not already installed, use your normal technique for installing, e.g. yum install screen
  2. To create a new screen session, simply type screen at the command prompt
  3. This opens another identical looking prompt. Now start whatever process you have in mind.
  4. To return to your original prompt (but with the new screen still running in the background) press Ctrl-a then d
  5. If you wish to return to the screen session later, just type screen -r
  6. At this point (while in the screen session) if you want to kill the session, press Ctrl-a then k and press y when it asks if you really want to kill the session.

Useful Links:
Screen user’s manual
Nice tutorial on more common usage

This entry was posted in Code Monkey and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *