GNU Screen is a terminal multiplexer that lets you manage multiple virtual terminal sessions within a single terminal window.
Session Management
# Start a new named session
screen -S mysession
# List all existing screen sessions
screen -ls
# Reattach to a running session
screen -r mysession
# Reattach and detach it from other terminals (-d -r)
screen -d -r mysession
Keybindings (Default Prefix: Ctrl+A)
All Screen commands begin by pressing Ctrl+A:
| Shortcut | Action |
|---|---|
Ctrl+A then d |
Detach from session (leaves processes running in background) |
Ctrl+A then c |
Create a new window |
Ctrl+A then n |
Switch to next window |
Ctrl+A then p |
Switch to previous window |
Ctrl+A then " |
List all windows to select interactively |
Ctrl+A then k |
Kill current window |
Ctrl+A then [ |
Enter scrollback / copy mode (Esc to exit) |
Screen Splitting
| Shortcut | Action |
|---|---|
Ctrl+A then S |
Split display horizontally |
Ctrl+A then | |
Split display vertically |
Ctrl+A then Tab |
Move focus to next split region |
Ctrl+A then X |
Close current split region |