Skip to content

screen — Simple Persistent Terminal Sessions

Problem

Same problem as tmux: SSH sessions die, jobs get killed, long-running tasks need to survive disconnects. screen is the older, simpler alternative to tmux — universally available and gets the job done with minimal setup.

Solution

screen creates detachable terminal sessions. It's installed by default on many systems, making it useful when tmux isn't available.

Installation (Fedora)

sudo dnf install screen

Core Workflow

# Start a named session
screen -S mysession

# Detach (keeps running)
Ctrl+a, d

# List sessions
screen -list

# Reattach
screen -r mysession

# If session shows as "Attached" (stuck)
screen -d -r mysession

Start a Background Job Directly

screen -dmS mysession bash -c "long-running-command 2>&1 | tee /root/output.log"
  • -d — start detached
  • -m — create new session even if already inside screen
  • -S — name the session

Capture Current Output Without Attaching

screen -S mysession -X hardcopy /tmp/screen_output.txt
cat /tmp/screen_output.txt

Send a Command to a Running Session

screen -S mysession -X stuff "tail -f /root/output.log\n"

screen vs tmux

Feature screen tmux
Availability Installed by default on most systems Usually needs installing
Split panes Basic (Ctrl+a, S) Better (Ctrl+b, ")
Scripting Limited More capable
Config complexity Simple More options

Use screen when it's already there or for quick throwaway sessions. Use tmux for anything more complex. See tmux.