16.10.2025

How to Install Screen on AlmaLinux 9

head-image

System administrators and DevOps engineers frequently need to run long-running commands or maintain persistent terminal sessions. GNU Screen solves this by allowing you to detach and reattach terminal sessions, ensuring processes continue running even when you disconnect.

What is GNU Screen?

GNU Screen is a terminal multiplexer that enables users to create multiple virtual terminal sessions within a single SSH connection. It allows you to detach from a session while keeping processes running, then reattach later from any location. Screen is essential for managing remote servers where network interruptions could terminate critical operations.

Key Features

  • Session persistence: Processes continue running after disconnection
  • Multiple windows: Run several commands in separate windows within one session
  • Session sharing: Multiple users can attach to the same session
  • Scrollback buffer: Review command output history
  • Copy-paste mode: Copy text between Screen windows

Installation

Update your system packages:

sudo dnf update -y

Install the EPEL repository:

sudo dnf install epel-release -y

Install Screen using the DNF package manager:

sudo dnf install screen -y

Verify installation:

screen --version

Basic Usage

Start a new Screen session:

screen

Start a named session for easier identification:

screen -S mysession

Detach from current session (press Ctrl+A then D):

# Inside screen, type: Ctrl+A, then D

List all Screen sessions:

screen -ls

Reattach to a session:

screen -r

Reattach to a specific named session:

screen -r mysession

Create a new window within Screen (press Ctrl+A then C):

# Inside screen, type: Ctrl+A, then C

Switch between windows (press Ctrl+A then N for next, P for previous):

# Inside screen, type: Ctrl+A, then N or P

Operational Tips

  • Long-running tasks: Use Screen for database migrations, backups, or compilation tasks that take hours
  • Remote operations: Always start Screen before running critical commands over SSH to prevent disconnection issues
  • Session naming: Use descriptive names like screen -S db-backup to identify sessions easily
  • Logging: Enable logging with Ctrl+A H to capture session output to a file
  • Configuration: Customize Screen behavior in ~/.screenrc with settings like scrollback buffer size and default shell

Common Commands

  • Kill a window: Ctrl+A then K
  • Lock screen: Ctrl+A then X
  • Enter copy mode: Ctrl+A then [
  • Split screen horizontally: Ctrl+A then S
  • View window list: Ctrl+A then "

Conclusion

GNU Screen provides essential session management capabilities for AlmaLinux 9 administrators. By maintaining persistent terminal sessions, you ensure critical operations complete successfully regardless of network stability. For intelligent incident management and automated issue resolution, consider using Akmatori, an open-source AI agent platform that helps SRE teams respond to infrastructure incidents faster.

FAQ

  • What's the difference between Screen and tmux?

    • Both are terminal multiplexers. tmux offers more features and active development, while Screen is simpler and more widely available by default.
  • Can I share my Screen session with another user?

    • Yes, use multi-user mode with screen -x sessionname to allow multiple users to attach simultaneously.
  • How do I increase the scrollback buffer?

    • Add defscrollback 10000 to your ~/.screenrc file to set the buffer to 10,000 lines.

Automate incident response and prevent on-call burnout with AI-driven agents!