Docs / Linux Basics / How to Use screen and tmux for Persistent Sessions

How to Use screen and tmux for Persistent Sessions

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 419 views · 1 min read

Screen and tmux let you run long-running commands that survive SSH disconnections.

screen

# Start a new session
screen -S mysession

# Detach from session
Ctrl+A, then D

# List sessions
screen -ls

# Reattach to session
screen -r mysession

tmux

# Start a new session
tmux new -s mysession

# Detach
Ctrl+B, then D

# List sessions
tmux ls

# Reattach
tmux attach -t mysession

# Split panes
Ctrl+B, then %    # Vertical split
Ctrl+B, then "    # Horizontal split
Ctrl+B, then arrow  # Switch panes

Install

# Ubuntu/Debian
apt install screen tmux -y

# RHEL-based
dnf install screen tmux -y

Was this article helpful?