Screen

Screen allows to manage multiple shells and keep them running in the background without a active terminal.

For instance, it’s’ useful when hosting applications or services.

Additional reference: https://astrobiomike.github.io/unix/screen-intro

Create and open a new screen

$ screen -S my_screen_session_name

Each screen receives a unique PID.

Switch between original window and screens

Screen –> Original (Detach)

To switch back to the original window, type Ctrl+A followed by a d (for detach).

Original –> Screen (Re-attach)

$ screen -r SCREEN_PID

List all screens

$ screen -ls

This list all screen in the following manner:

SCREEN_PID.SESSION_NAME (CREATION_TIMEDATE) (STATUS)

The status shows ATTACHED if the screen in attached to your terminal, or DETACHED in case not.

Kill a screen

To kill the currently attached screen, type Ctrl+A followed by a k (for kill).

Alternatively, while not being detached to any screen, kill a screen via

$ screen -XS SCREEN_PID quit

passing the that screen’s SCREEN_PID.