There are a number of circumstances under which it is useful to be able to move the same session between computers or leave commands running in the background then come back to them later. screen is ideal for this.

The command is initially invoked with the following command:

$ screen

This will start a new screen session in which you can do anything you can do in a normal session. The only difference is that it takes over Ctrl-a as an escape character to run its own commands. If you want to use Ctrl-a (Home) normally, you will need to press Ctrl-a a. Help is available with the key-combination Ctrl-a ?.

You can also make screen run a command directly, without going to the shell. For example, to start Milliways, you would type:

$ screen mw

Once you are running a command, you can detatch the session with Ctrl-a d. If you want to end the session that you opened screen from as well, use Ctrl-a DD.

When you want to reattach the session, you can use:

$ screen -r

If you left the screen attached and want to close that terminal and reconnect it in your current session, use:

$ screen -Dr

You can also reattach the session without closing it elsewhere. The command for this is:

$ screen -x
Page last modified on Wed, 21 Nov 2018 17:37:18 +0000