Screen vs tmux: Why Use Screen on Linux
In this article
Use GNU Screen instead of tmux when you want a terminal multiplexer that is preinstalled on most Linux systems, has a simpler learning curve, and works reliably over slow or unstable connections. Screen has been around since 1987, so it is the default choice on many servers and minimal distributions, and its configuration and command syntax are often easier for beginners to grasp.
Background: What Terminal Multiplexers Do
Both Screen and tmux solve the same core problem: they let you run multiple terminal sessions inside a single SSH connection, keep those sessions alive when you disconnect, and reattach to them later. This is essential for long-running tasks like compiling software, running a web server, or monitoring logs. Without a multiplexer, closing your laptop or losing network connectivity would kill the processes running in your terminal.
Screen was created by Oliver Laumann and others in 1987, making it one of the oldest Unix utilities still in active use. Tmux, released in 2007 by Nicholas Marriott, was designed as a modern alternative with a client-server architecture and better scripting support. The choice between them often comes down to system defaults, personal workflow, and the specific features you need.
How Screen Works
Screen works by creating a daemon process that manages multiple virtual terminals. When you start Screen, it creates a new session with a single window. You can then create additional windows, split the screen into regions, and detach from the session while leaving your processes running. When you reconnect, you attach to the same session and see your work exactly as you left it.
The key commands are:
screen– start a new sessionscreen -r– reattach to a detached sessionscreen -S name– start a session with a custom nameCtrl-a c– create a new windowCtrl-a n/Ctrl-a p– switch to next/previous windowCtrl-a d– detach from the session
Screen uses Ctrl-a as its command prefix, which is easy to type but can conflict with the Bash shortcut for moving to the beginning of a line. Many users remap it to Ctrl-t or another key to avoid that conflict.
Why You Might Prefer Screen
There are several concrete reasons to choose Screen over tmux in a Linux environment:
- Preinstalled by default: Many minimal Linux distributions, older enterprise systems, and rescue environments include Screen but not tmux. On a bare-bones server, you can start using Screen immediately without installing anything.
- Lighter resource footprint: Screen tends to use less memory and CPU than tmux, which can matter on very small VPS instances or embedded systems.
- Simpler configuration: The
.screenrcfile uses straightforward key bindings and commands. Tmux's configuration language is more powerful but also more complex for newcomers. - Better for serial connections: Screen has built-in support for serial ports (
screen /dev/ttyUSB0 9600), which tmux lacks. This makes Screen the go-to tool for working with routers, microcontrollers, or other serial devices. - Proven stability: Screen has been battle-tested for decades. It is extremely reliable, especially over high-latency or unreliable connections, because it was designed when network connections were far less stable than today.
Common Problems and How Screen Handles Them
One common issue with terminal multiplexers is dealing with a session that becomes unresponsive. If your SSH connection drops, the session stays alive but may be marked as “dead.” With Screen, you can list sessions with screen -ls and reattach with screen -r. If the session is marked as “dead,” you can clean it up with screen -wipe.
Another frequent problem is forgetting which session you left running. Screen allows you to name sessions and windows, making it easier to identify them. For example, screen -S web-server creates a session named “web-server,” and within that session you can use Ctrl-a A to set a window title.
Screen also handles the “screen is already busy” error that occurs when you try to reattach to a session that is still attached. You can force detach with screen -d -r, which detaches the other client and reattaches you in one command.
How to Choose Between Screen and Tmux
The decision often comes down to your environment and workflow. If you regularly work on systems where you cannot install new packages, Screen is the safer bet. If you are setting up a personal development environment on a machine you control, tmux offers better scripting, more flexible layouts, and a more active development community.
Consider these factors:
- System access: Do you have sudo rights to install tmux? If not, use Screen.
- Team collaboration: Tmux has built-in session sharing via
tmux attachand thetmux-resurrectplugin ecosystem, which some teams prefer. Screen can share sessions too, but it is less intuitive. - Scripting needs: Tmux's command-line interface is more powerful for automating complex layouts. Screen is simpler but less expressive.
- Personal familiarity: If you already know one well, switching may not be worth the effort unless you need a specific feature.
Screen vs Tmux: A Side-by-Side Look
Both tools offer similar core features, but the details differ:
- Command prefix: Screen uses
Ctrl-a; tmux usesCtrl-b. Many users findCtrl-bless likely to conflict with shell shortcuts. - Window splitting: Both support horizontal and vertical splits. Tmux makes it easier to create complex layouts and move between panes with
Ctrl-b %andCtrl-b ". - Session persistence: Both keep sessions alive after disconnection. Tmux has a “detach other clients” feature (
tmux detach-client) that is more granular than Screen's. - Status bar: Tmux has a highly customizable status bar with system information, while Screen's default is minimal. You can add a status line to Screen via configuration, but it requires more effort.
- Copy mode: Both have a copy mode for scrolling and selecting text. Tmux integrates better with the system clipboard on modern terminals.
Costs and Limitations of Screen
Screen is not without drawbacks. Its default configuration is sparse, so many users add a .screenrc to enable a status line, change the escape key, or set scrollback buffer size. The learning curve for advanced features like vertical splits (Ctrl-a |) and regions (Ctrl-a S) is steeper because the commands are less discoverable.
Screen's scripting capabilities are weaker than tmux's. For example, tmux allows you to send commands to a session with tmux send-keys, which is handy for automation. Screen has a similar feature (screen -X stuff), but it is less documented and less flexible.
Another limitation is that Screen does not support true color (24-bit color) in all terminal emulators, while tmux does. If you use themes that rely on true color, tmux will render them more accurately.
Safety and Best Practices
When using Screen, always detach properly with Ctrl-a d rather than closing the terminal window. This ensures your session is saved. If you are running critical processes, consider using nohup or a service manager as a backup, because Screen itself does not protect against system reboots.
Be careful when using screen -x to attach to a session that is already attached. This allows multiple users to share a session, which can be useful for pair programming but also means anyone attached can see and type in your terminal. Only use this on trusted systems.
Also, remember that Screen's escape key Ctrl-a can interfere with the Bash shortcut Ctrl-a (move to beginning of line). If this bothers you, remap it in your .screenrc with escape ^Tt to use Ctrl-t instead.
Frequently Asked Questions
Is Screen installed by default on most Linux distributions?
Yes, Screen is included in the default installation of many distributions, including Debian, Ubuntu, CentOS, and most minimal server images. Tmux is also common but may not be present on minimal or older systems.
Can I use Screen and tmux together?
Yes, you can run tmux inside Screen or vice versa, but it is generally not recommended because it creates confusing key bindings and unnecessary complexity. Choose one and stick with it.
How do I scroll back in Screen?
Press Ctrl-a [ to enter copy mode, then use the arrow keys or Page Up/Page Down to scroll. Press Esc to exit. To increase scrollback buffer, add defscrollback 10000 to your .screenrc.
Does Screen work over a slow connection?
Yes, Screen is designed to work efficiently over low-bandwidth and high-latency connections. It only sends the changes to the screen, so it feels responsive even on a 56k modem.
Can I share a Screen session with another user?
Yes, you can use screen -x to attach to an already attached session, allowing multiple users to interact with the same terminal. This requires the same user account or proper permissions.
What is the difference between Screen and tmux for scripting?
Tmux has a more powerful command-line interface and a well-documented control mode, making it easier to script complex layouts. Screen can be scripted with screen -X commands, but it is less flexible and less commonly used for automation.