Linux GNU Screen

Have you at any point confronted the circumstance where you play out a long-running assignment on a remote machine, and unexpectedly your association drops, the SSH meeting is ended, and your work is lost. All things considered, it has happened to us all sooner or later, hasn’t it? Fortunately, there is a utility called screen that permits us to continue the meetings

What is Screen

Screen command ability to launch and use multiple shell session from single SSH session. Processes running in Screen will continue to run when their window is not visible even if you get disconnected.

Install

The screen package is pre-installed on most Linux distros nowadays. You can check if it is installed on your system by typing:

screen --version

If you don’t have screen installed on your system, you can easily install it using the package manager

sudo apt update
sudo apt install screen

Install Screen on CentOS and Fedora

sudo yum install screen

Start Screen

To start a screen session, simply type screen in your console:

screen

This will open a screen session, make another window, and begin a shell in that window.

Now you can type list of command whatever you want.

Starting Named Session

Named session are helpful when you run different screen session. To make a named session, run the screen order with the following arguments:

screen -S session_name

Detach/restarting screen 

If you want log out from your SSH, or close down your computer, but still keep the terminal session running, you have to detach it. This is different then exiting screen.

If you exit screen, by typing exit, you lose that session. To detach it, type Ctrl-a Ctrl-d (most commands in screen start with Ctrl-a, this overrides the Ctrl-a command normally used when you want to jump to the start of a line). 

List Screen Sessions

To display all list of sessions, run command:

screen -ls

Reattach to a Screen

To resume your screen session use the following command:

screen -r

In case you have multiple screen sessions running on your machine, you will need to append the screen session ID after the r switch.

That is it for today, hope it helps.  If you have any suggestion for this article please make a comment in comment section below.

If you like this article, you can buy me a coffee. Thanks!

Linux GNU Screen

One thought on “Linux GNU Screen

  1. You’re so cool! I don’t think I’ve truly read anything like that before. So great to find another person with some original thoughts on this topic. Seriously.. many thanks for starting this up. This site is something that’s needed on the web, someone with some originality!

Leave a Reply

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

Scroll to top