Master the Terminal: A Guide to Installing and Using the Screen Tool on AlmaLinux 9 and Rocky Linux

The GNU Screen tool is a powerful terminal multiplexer that is an essential utility for system administrators and developers working on Linux systems. It allows you to manage multiple terminal sessions from a single window and, most importantly, keeps processes running in the background even when you are disconnected. This is particularly useful for long-running tasks like large file transfers, system updates, or scripts.

This article provides a step-by-step guide to installing and using the screen tool on AlmaLinux 9 and Rocky Linux, two popular enterprise-grade operating systems.


Step 1: Update Your System

Master the Terminal: A Guide to Installing and Using the Screen Tool on AlmaLinux 9 and Rocky Linux

The GNU Screen tool is a powerful terminal multiplexer that is an essential utility for system administrators and developers working on Linux systems. It allows you to manage multiple terminal sessions from a single window and, most importantly, keeps processes running in the background even when you are disconnected. This is particularly useful for long-running tasks like large file transfers, system updates, or scripts.

This article provides a step-by-step guide to installing and using the screen tool on AlmaLinux 9 and Rocky Linux, two popular enterprise-grade operating systems.

Step 1: Update Your System

Before installing any new software, it’s a best practice to ensure your system’s package index is up to date. This helps prevent conflicts and ensures you’re installing the latest versions of packages. Open your terminal and run the following command:

sudo dnf update -y

Step 2: Enable the EPEL Repository

The screen package is not available in the default AlmaLinux or Rocky Linux repositories. You’ll need to enable the Extra Packages for Enterprise Linux (EPEL) repository to access it. Run the following command to install the EPEL repository:

sudo dnf install epel-release -y

Step 3: Install the Screen Tool

Once the EPEL repository is enabled, you can install the screen tool using the dnf package manager. Execute the following command:

sudo dnf install screen -y

To verify the installation was successful, you can check the version:

screen --version

Step 4: Basic Screen Tool Usage

Now that screen is installed, you can start using it to manage your terminal sessions.

  • Start a new session: To begin a new screen session, simply type:screen This will create a new virtual terminal window.
  • Detach from a session: To leave a session running in the background, use the following key combination:Ctrl + A, then D Your terminal will return to its original state, but the screen session will continue to run.
  • List active sessions: To see all the screen sessions currently running on your system, use the command:screen -ls
  • Reattach to a session: To reconnect to a detached session, use the session ID from the list. For example, if your session ID is 12345, you would run:screen -r 12345
  • Terminate a session: To end a session completely, reattach to it and type exit at the command prompt.

Step 5: Advanced Screen Features

The screen tool offers many advanced features for more complex workflows:

  • Named Sessions: Create a session with a descriptive name for easier management:screen -S my_session_name
  • Split Windows: You can split your screen session into multiple horizontal or vertical windows using key combinations.
  • Scrollback History: Access a buffer of past output within your session.
  • Logging: Record all output from a session to a file for later review.

The GNU Screen tool is a powerful and flexible utility that significantly enhances your command-line productivity. By following these simple steps, you can install and begin using it to manage your terminal sessions on AlmaLinux 9 or Rocky Linux.

Bash