Operations 7 min read

Master GNU Screen: Session Sharing, Persistence, and Split Screens

This guide explains how to install GNU screen, create shared sessions across multiple hosts, keep tasks running after network interruptions or window closures, and use screen's vertical split feature to manage multiple terminals within a single session.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master GNU Screen: Session Sharing, Persistence, and Split Screens

Overview

screen is a GNU‑developed terminal multiplexer that allows multiple terminal windows to attach to the same shell session. Processes started inside a screen session continue running even if the network drops or a window is closed.

Installation

On Debian/Ubuntu based systems: sudo apt install screen -y On CentOS/RHEL you must enable the EPEL repository before installing:

sudo yum install epel-release   # or: sudo dnf install epel-release
sudo yum install screen       # or: sudo dnf install screen

Session sharing

1. Create a named session on the host that will be shared (host A): screen -S it 2. From another host (host B) SSH into host A and list existing sessions:

ssh [email protected]
screen -ls

3. Attach to the shared session: screen -x it Both terminals now see the same shell. To leave the session without terminating the processes, detach with Ctrl‑A D . To end the session for all participants, type exit in any attached window.

Keeping tasks alive after disconnection

Start a long‑running command inside a screen session, for example:

screen -S test
ping 10.10.10.1

From a second terminal you can verify the process is running: ps aux | grep ping If the original window is closed, the ping continues because it is owned by the detached screen session. Later you can list sessions with screen -ls and re‑attach: screen -r test When only one session exists, the session name can be omitted ( screen -r).

Vertical split layout

Screen can split the terminal into multiple regions:

Start a new session: screen -S split_demo Enter split mode: press Ctrl‑A S . This creates a horizontal split (upper and lower regions).

Switch focus to the lower region: press Ctrl‑A Tab .

Create a new window in the active region: press Ctrl‑A C . Each region now runs its own shell.

Toggle between regions again with Ctrl‑A Tab .

To close a region, exit the shell inside it ( exit). The split layout persists until the entire screen session ends.

Example screenshots (originally from the article):

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxsplit-screensession sharingterminal multiplexingGNU Screen
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.