screen Cheatsheet - Terminal Session Manager Reference

The one command you must internalize is the detach/reattach pair — start with `screen -S name`, quit worry-free with Ctrl-a d, and come back later with `screen -r name`. Everything else (windows, splits, -x sharing) builds on that base; this table lays it out so your long jobs keep running after the network drops.

SysOps·38 commands·Last updated 2026-07-21
screenTerminalsshReuse

Session Management 8

screen -S name
Create a named session
screen -ls
List all sessions
screen -r name
Reattach to a named session
screen -d name
Detach a session (without terminating)
screen -x name
Attach to an already-attached session (shared)
screen -X -S name quit
Terminate a named session
Ctrl+a d
Detach current session (keeps running in background)
screen -RD name
Force-detach remote and reattach (most common recovery)

Windows 8

Ctrl+a c
Create a new window
Ctrl+a n / p
Next / previous window
Ctrl+a 0-9
Switch to window by number
Ctrl+a A
Rename current window
Ctrl+a k
Close current window (confirm)
Ctrl+a w
List all windows
Ctrl+a "
Interactively select a window
Ctrl+a Ctrl+a
Toggle between current and previous window

Split Screen 5

Ctrl+a S
Split horizontally (top/bottom)
Ctrl+a |
Split vertically (left/right, screen 4.1+)
Ctrl+a Tab
Cycle focus between splits
Ctrl+a X
Close current split
Ctrl+a Q
Close all splits except current

Copy Mode 6

Ctrl+a [
Enter copy mode; scroll and select text
Space
Start selection (vi mode)
Enter
Copy the selection
Ctrl+a ]
Paste the last copied text
Ctrl+a Esc
Exit copy mode
PageUp / PageDown
Scroll pages

Other 5

Ctrl+a ?
Show all key bindings
Ctrl+a :
Enter command mode
Ctrl+a H
Start/stop logging
Ctrl+a x
Lock the session (password)
screen -dmS name cmd
Create a session in the background and run a command

Configuration (.screenrc) 6

startup_message off
Disable the startup copyright banner
defscrollback 10000
Set scrollback buffer to 10000 lines
term xterm-256color
Set terminal type for 256 colors
escape ^Bb
Change the prefix key to Ctrl+b (avoid conflicts)
screen -t editor 1 vim
Auto-create a named window and run a command at start
caption always "%n %t"
Always show window number and title at the bottom

Tips

  • After SSH drops, the screen session survives; re-ssh and screen -r to resume — essential for remote work.
  • Ctrl+a is the default prefix; change it in ~/.screenrc if it clashes with the terminal.
  • screen is dated; for new projects prefer tmux (modern, plugin-supporting).

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us