Skip to content

Set Up Screen on a Linux Server – Manage Persistent Terminal Sessions

Discover how to manage multiple terminal sessions on Linux with Screen for increased productivity and persistent sessions → Learn more now

12 November 20262 min read15 Views0 helpful

Introduction

Screen is a terminal multiplexer for Unix-like operating systems such as Linux. It allows you to manage multiple terminal sessions within a single window or remote connection. In this guide, we’ll show you the installation steps and provide tips on how to use Screen easily.

Preparation

Before installing anything on your server, be sure to run the update command for your operating system to keep your server secure and up to date.

Code
sudo apt update && sudo apt upgrade
Code
sudo yum update
Code
sudo zypper update
Code
 sudo dnf update

Installation

Installing Screen is super easy—just run the appropriate command for your Linux distribution:

Code
sudo apt install screen
Code
sudo yum install screen
Code
sudo zypper install screen
Code
sudo dnf install screen

Basic Screen Usage

As mentioned, you can create multiple sessions with Screen. To start a new one, simply enter the following command, replacing [name] with any name you choose.

Code
screen -S [name]
Info

Note that the commands in this guide are case-sensitive, especially the parameter flags.

This opens a new Screen session where you can run scripts or programs that will continue running even after closing the remote connection.

You can detach from a Screen session by pressing CTRL + A followed by D, or end it by typing exit in the terminal.

Tip

You can list all active sessions/screens with screen -ls or screen -list.

To return to an existing session, use the command screen -r [name], which takes you directly to the desired session.

Screen Parameter Flags

Screen offers many - parameter flags to customize commands. Here are the most important ones in the table:

FlagAliasInfo
-vShows the current Screen version
-S [name]Starts a new Screen session named [name]
-ls-listLists all running screens
-wipe [name]Deletes screens, optionally by name [name]
-r [name]Attaches you to the Screen session [name]
-d -r [name]Detaches your current session and attaches you to [name]
Tip

Find all available parameters with screen -h – this provides a detailed overview.

Advanced Screen Usage

Window Management

Now that you know the basics, here are some shortcuts to help you manage your sessions even better. Within a Screen session, you can create multiple windows for different tasks.

Info

All shortcuts here work only after pressing CTRL + A.

Pressing C creates a new empty window in the current directory. Switch between windows with N (next), P (previous), or " – then use the arrow keys to select the desired window.

By default, all windows have the same name (usually the shell name). You can rename windows with A.

And you can delete a window with K.

Splitting Windows

To display two windows side by side, use S for horizontal split or | for vertical split, and switch between them with Tab.

Tip

After creating a split window, switch there with Tab and open a previous window in the second view with ".

You can split as many windows as you want—but keep in mind that running many tasks in parallel can quickly increase your server’s RAM usage.

Conclusion

We hope this guide has helped you understand and effectively use Screen on Linux. If you have any questions or need assistance, our support team is available daily! 🙂

FAQ

Frequently asked questions

First update your system, then install Screen using the appropriate command for your distribution, e.g., sudo apt install screen on Debian/Ubuntu.
Use the command screen -S [name], replacing [name] with any name you want for the session.
Press CTRL + A followed by D to detach. To end the session completely, type exit in the terminal.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 Users found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.