screen cheatsheet

This is a quick reference guide cheat sheet for the screen command.

#Getting started

#Getting started

$ screen 

Press Ctrl-a d to detach session

List all screen sessions

$ screen -ls

Re-attach a screen Session

screen -r <name/pid>

#Options

OptionsExampleDescription
-Sscreen -S debugStart a new session with session name
-lsscreen -lsList running sessions / screens
-xscreen -xAttach to a running session
-rscreen -r debugAttach to a running session with name
-Rscreen -R debugAttach to a session
(Will create if it doesn't exist)
-dscreen -d -m wget xxxx.com/large.fileStart screen in detached mode
-Xscreen -X -S debug killKill a running session

#Help

CommandDescription
Ctrl-a?See help (Lists keybindings)

#Window Management

CommandDescription
Ctrl-acCreate new window
Ctrl-aCtrl-aChange to last-visited active window
Ctrl-a0...9Change to window by number
Ctrl-a'<0...9 or title>Change to window by number or name
Ctrl-an or Ctrl-a<space>Change to next window in list
Ctrl-ap or Ctrl-a<backspace>Change to previous window in list
Ctrl-a"See window list
Ctrl-awShow window bar
Ctrl-akKill current window (not recommended)
Ctrl-a\Kill all windows (not recommended)
Ctrl-aARename current window

#Getting Out

CommandDescription
Ctrl-adDetach
Ctrl-aDDDetach and logout
(quick exit)
Ctrl-a:Exit all session
Ctrl-aC-\Force-exit screen
(not recommended)

#Split screen

CommandDescription
Ctrl-aSSplit display horizontally
Ctrl-aVSplit display vertically
Ctrl-a|Split display vertically
Ctrl-atabJump to next display region
Ctrl-aXRemove current region
Ctrl-aQRemove all regions but the current one

#Misc

CommandDescription
Ctrl-aC-lRedraw window
Ctrl-a[Copy mode
Ctrl-a<esc>Copy mode
Ctrl-a]Paste
Ctrl-aMMonitor window for activity
Ctrl-a_Monitor window for silence
Ctrl-aCtrl-vEnter digraph
(non-ASCII characters)
Ctrl-axLock (password protect) display
Ctrl-a:Enter screen command
Ctrl-aHEnable logging in the screen session

#Screen tricks

Ssh and attach in one line.

$ ssh -t user@host screen -x <name/pid>