Screen

Screen tool is very useful if you need to disconnect from remote server, or you have a shaky connection that tends to drop but the started process on remote server needs to continue. You can reconnect later and any process started in screen session continues while you are disconnected. You are able to resume that session using screen tool.

Install Screen on Ubuntu and Debian:

apt update
apt install screen

To start a screen session just type:

screen

This opens a screen session, creates a new window, and starts a shell in that window.

To detach from Linux screen session, press hotkey combination:

To reattach screen session:

screen -r

To list screen sessions:

screen -ls

Output of this command also gives screen.session.numbers used to reattach a certain session without custom name.

To kill screen session, in that session type:

exit

For multiple screen sessions its easier to give custom names to different sessions. To start a session with custom name:

screen -S session_name

To list available screen sessions:

screen -ls

To reattach certain screen session without custom session names:

screen -r screen.session.number

To reattach certain screen session with custom session names:

screen -r screen.session.name

or you can also use screen.session.numbers.

Based on: linuxize.com

Leave a Comment

Tested on Ubuntu & Pop OS