This is an old revision of the document!
How to Navigate, copy & paste content?
within screen sessions: Cntl a + [ : To start navigation using up/down arrow Press Space bar: To select content starting position Press Space bar again: To select a block of content Cntl a + ] : To paste the selected content
start a new screen session with session name | screen -S <name> |
list running sessions/screens | screen -ls |
attach to a running session | screen -x |
… to session with name | screen -r <name> |
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.) |
detach a running session | screen -d <name> |
All screen commands are prefixed by an escape key, by default C-t
(that's Control-t, sometimes written ^a
). To send a literal C-t
to the programs in screen, use C-t a
. This is useful when working with screen within screen. For example C-t a n
will move screen to a new window on the screen within screen.
create new window | C-t c |
change to last-visited active window | C-t C-a (commonly used to flip-flop between two windows) |
change to window by number | C-t <number> (only for windows 0 to 9) |
change to window by number or name | C-t ' <number or title> |
change to next window in list | C-t j or C-t <space> |
change to previous window in list | C-t u or C-a <backspace> |
see window list | C-t " (allows you to select a window to change to) |
show window bar | C-t w (if you don't have window bar) |
close current window | Close all applications in the current window (including shell) |
kill current window | C-t k (not recommended) |
kill all windows | C-t \ (not recommended) |
rename current window | C-t A |
split display horizontally | C-t S |
split display vertically | C-t | or C-t V (for the vanilla vertical screen patch) |
jump to next display region | C-t tab |
remove current region | C-t X |
remove all regions but the current one | C-t Q |
# the screen name session has to be valid or else, message: No screen session found.
send a command to a named session | screen -S <name> -X <command> |
create a new window and run ping example.com | screen -S <name> -X screen ping example.com |
stuff characters into the input buffer using bash to expand a newline character (from here) | screen -S <name> [-p <page>] -X stuff $'quit\r' |
a full example | # run bash within screen screen -AmdS bash_shell bash # run top within that bash session screen -S bash_shell -p 0 -X stuff $'top\r' # ... some time later # stuff 'q' to tell top to quit screen -S bash_shell -X stuff 'q' # stuff 'exit\n' to exit bash session screen -S bash_shell -X stuff $'exit\r' |
redraw window | C-t C-l |
enter copy mode | C-t [ or C-t <esc> (also used for viewing scrollback buffer) |
paste | C-t ] |
monitor window for activity | C-t M |
monitor window for silence | C-t _ |
enter digraph (for producing non-ASCII characters) | C-t C-v |
lock (password protect) display | C-t x |
enter screen command | C-t : |
enable logging in the screen session | C-t H |
getting out of the screen session | exit |
In copy mode, one can navigate the scrollback buffer in various ways:
half page up | C-u |
half page down | C-d |
cursor left/down/up/right | h/j/k/l |