Using screen

The screen program is a powerful terminal multiplexer for Unix-like operating systems such as Linux. It allows you to create multiple virtual terminals within a single terminal window or remote session, which can be detached and reattached as needed, even if the original terminal session is disconnected.

Using screen, you can run multiple command-line applications or shell sessions within a single terminal window, allowing you to switch between them easily and even leave them running in the background while you work on other tasks. This can be particularly useful when working on remote systems or when you need to keep long-running processes running in the background.

Some of the key features of screen include:

  • Multiple virtual terminals within a single terminal window.
  • Detachable and reattachable sessions, even across different machines.
  • Built-in support for session logging and monitoring.
  • Customizable key bindings and configuration options.
  • Overall, screen is a versatile and powerful tool that can be very useful for managing multiple terminal sessions and keeping long-running processes running smoothly.

Now we know what it is, let’s install it.

For Alma/Rocky

dnf config-manager --set-enabled powertools
dnf install epel-release

For Debian/Ubuntu

sudo yum install epel-release

Now , let’s install screen

yum install screen -y

Once installed, here are some basic commands to use the screen program:

Start a new session:

screen

Start a new session with a custom name:

screen -S session_name

Detach from a session:

Ctrl + A then d

List active sessions:

screen -ls

Reattach to a session:

screen -r session_id

Kill a session:

screen -X -S session_id quit

Once you are in a screen session, you can create new windows by pressing

Ctrl + A then c

You can switch between windows by pressing

Ctrl + A then n (next) or p (previous)

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.