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
Options | Example | Description |
---|---|---|
-S | screen -S debug | Start a new session with session name |
-ls | screen -ls | List running sessions / screens |
-x | screen -x | Attach to a running session |
-r | screen -r debug | Attach to a running session with name |
-R | screen -R debug | Attach to a session (Will create if it doesn't exist) |
-d | screen -d -m wget xxxx.com/large.file | Start screen in detached mode |
-X | screen -X -S debug kill | Kill a running session |
#Help
Command | Description |
---|---|
Ctrl-a ? | See help (Lists keybindings) |
#Window Management
Command | Description |
---|---|
Ctrl-a c | Create new window |
Ctrl-a Ctrl-a | Change to last-visited active window |
Ctrl-a 0...9 | Change to window by number |
Ctrl-a ' <0...9 or title> | Change to window by number or name |
Ctrl-a n or Ctrl-a <space> | Change to next window in list |
Ctrl-a p or Ctrl-a <backspace> | Change to previous window in list |
Ctrl-a " | See window list |
Ctrl-a w | Show window bar |
Ctrl-a k | Kill current window (not recommended) |
Ctrl-a \ | Kill all windows (not recommended) |
Ctrl-a A | Rename current window |
#Getting Out
Command | Description |
---|---|
Ctrl-a d | Detach |
Ctrl-a D D | Detach and logout (quick exit) |
Ctrl-a : | Exit all session |
Ctrl-a C-\ | Force-exit screen (not recommended) |
#Split screen
Command | Description |
---|---|
Ctrl-a S | Split display horizontally |
Ctrl-a V | Split display vertically |
Ctrl-a | | Split display vertically |
Ctrl-a tab | Jump to next display region |
Ctrl-a X | Remove current region |
Ctrl-a Q | Remove all regions but the current one |
#Misc
Command | Description |
---|---|
Ctrl-a C-l | Redraw window |
Ctrl-a [ | Copy mode |
Ctrl-a <esc> | Copy mode |
Ctrl-a ] | Paste |
Ctrl-a M | Monitor window for activity |
Ctrl-a _ | Monitor window for silence |
Ctrl-a Ctrl-v | Enter digraph (non-ASCII characters) |
Ctrl-a x | Lock (password protect) display |
Ctrl-a : | Enter screen command |
Ctrl-a H | Enable logging in the screen session |
#Screen tricks
Ssh and attach in one line.
$ ssh -t user@host screen -x <name/pid>