Getting in
start a new screen session: screen
attach to a running session: screen -r
attach multiple terminals to an attached, running session: screen -rx
the “ultimate attach”: screen -dRR (Attaches to a screen session. If the session is attached elsewhere, detaches that other display. If no session exists, creates one. If multiple sessions exist, uses the first one.)
Escape key
All screen commands are prefixed by an escape key, by default Ctrl+a (sometimes written ^A). To send a literal Ctrl+a to the programs in screen, use Ctrl+a a.
Getting out
detach: Ctrl+a d
exit screen: exit all of the programs in screen.
force-exit screen: Ctrl+a C-\ (not recommended)
Help
See help: Ctrl+a ? (lists keybindings)
Window Management
create new window: Ctrl+a c
change to last active window: Ctrl+a Ctrl+a
change to window by number: Ctrl+a <number> (only for windows 0 to 9)
change to window by number or name: Ctrl+a ' <number or title>
change to next window in list: Ctrl+a n or Ctrl+a <space>
change to previous window in list: Ctrl+a p
see window list: Ctrl+a “
close current window: Close all applications in the current window (including shell)
kill current window: Ctrl+a k (not recommended)
Split screen
split display: Ctrl+a S
jump to next display region: Ctrl+a tab
remove current region: Ctrl+a X
remove all regions but the current one: Ctrl+a Q
Misc
redraw window: Ctrl+a C-l
enter copy mode: Ctrl+a [ (also used for viewing scrollback buffer)
paste: Ctrl+a ]
monitor window for activity: Ctrl+a M
monitor window for silence: Ctrl+a _
enter digraph: Ctrl+a Ctrl+v
lock (password protect) display: Ctrl+a x
enter screen command: Ctrl+a :
April 11th, 2008 at 2:53 pm
You can use -S to give a screen session a unique name for ease of use.
example of usage;
Create a screen session that will be used for a large build/compile operation where remote shell disconnection could leave a system in an inconsistent state (Which is never good)
’screen -S kernupgrade’
detach the screen when connected by using CTRL+A+D (ENSURE THE USE OF ‘A’ OR YOU WILL END THE SESSION)
You can then list the available screen sessions by using
’screen -ls’
You should see something similar to;
# screen -ls
There are screens on:
40347.demo (Detached)
40808.kernupgrade (Detached)
2 Sockets in /tmp/screens/S-root.
reattach the session by using
’screen -r kernupgrade’
Lovely isn’t it