Day: September 30, 2019

Using the Screen command

Screen command benefits

  • Can be used to launch multiple shells from a single SSH session.
  • Detach and re-attach from multiple ssh session.
  • Running process which can take more time and need session to be kept alive.
  • To keep the session alive without any network disruptions.

The command to create a screen session is

screen -t <screen name> -S <socket file name>

To detach a screen session

ctrl+a + d

To list the screen sessions

screen -ls

To reattach the screen session

screen -r <pid/name from the list>

Presume you lost the console where the screen was running before detaching the screen. You can detach and reattach using the below command

screen -dr <pid/name from the list>