This shows you the differences between two versions of the page.
quick_reference [2017/05/16 18:33] asciiphil old revision restored |
quick_reference [2018/01/11 15:01] (current) 128.214.166.186 |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== screen Quick Reference ====== | + | ====== SCREEN Quick Reference ====== |
- | How to Navigate, copy & paste content? | + | |
- | within screen sessions: | + | ===== Getting in test ==== |
- | 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 | + | |
- | + | ||
- | ===== Getting in ===== | + | |
| start a new screen session with session name | ''screen -S //<name>//'' | | | start a new screen session with session name | ''screen -S //<name>//'' | | ||
| list running sessions/screens | ''screen -ls'' | | | list running sessions/screens | ''screen -ls'' | | ||
| attach to a running session | ''screen -x'' | | | attach to a running session | ''screen -x'' | | ||
- | | ... to session with name | ''screen -r //<name>//'' | | + | | attach to session //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.) | | | 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>//'' | | ||
===== Escape key ===== | ===== Escape key ===== | ||
Line 31: | Line 22: | ||
| force-exit screen | ''[[commands:quit|C-a C-\]]'' (//not// recommended) | | | force-exit screen | ''[[commands:quit|C-a C-\]]'' (//not// recommended) | | ||
| getting out of the screen session | exit | | | getting out of the screen session | exit | | ||
- | |||
- | ===== Help ==== | ||
- | |||
- | | See help | ''[[commands:help|C-a ?]]'' (lists keybindings) | | ||
- | |||
- | The [[man:start|man page]] is the complete reference, but it's very long. | ||
===== Window Management ===== | ===== Window Management ===== | ||
Line 56: | Line 41: | ||
| split display horizontally | ''[[commands:split|C-a S]]'' | | | split display horizontally | ''[[commands:split|C-a S]]'' | | ||
- | | split display vertically | ''[[commands:split|C-a | or C-a V (for the vanilla vertical screen patch)]]'' | | + | | split display vertically | ''[[commands:split|C-a |]]'' or ''[[commands:split|C-a V]]'' (for the vanilla vertical screen patch) | |
| jump to next display region | ''[[commands:focus|C-a tab]]'' | | | jump to next display region | ''[[commands:focus|C-a tab]]'' | | ||
| remove current region | ''[[commands:remove|C-a X]]'' | | | remove current region | ''[[commands:remove|C-a X]]'' | | ||
| remove all regions but the current one | ''[[commands:only|C-a Q]]'' | | | remove all regions but the current one | ''[[commands:only|C-a Q]]'' | | ||
+ | |||
+ | ===== Clipboard and Navigation ===== | ||
+ | |||
+ | | freely navigate buffer | ''[[commands:copy|C-a [ ]]'' or ''[[commands:copy|C-a <esc>]]'' | | ||
+ | | toggle selection to copy | ''[[commands:copy|space]]'' | | ||
+ | | paste | ''[[commands:copy|C-a ] ]]'' | | ||
+ | |||
+ | ===== Help ===== | ||
+ | |||
+ | | See help | ''[[commands:help|C-a ?]]'' (lists keybindings) | | ||
+ | |||
+ | The [[man:start|man page]] is the complete reference. | ||
===== Scripting ===== | ===== Scripting ===== | ||
- | # the screen name session has to be valid or else, message: No screen session found. | + | |
+ | To any session //name//, | ||
| send a command to a named session | ''screen -S //<name>// -X //<command>//'' | | | 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//'' | | | 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\\ ([[http://lists.gnu.org/archive/html/screen-users/2007-06/msg00012.html|from here]]) | <code bash>screen -S <name> [-p <page>] -X stuff $'quit\r'</code> | | | stuff characters into the input buffer\\ using bash to expand a newline character\\ ([[http://lists.gnu.org/archive/html/screen-users/2007-06/msg00012.html|from here]]) | <code bash>screen -S <name> [-p <page>] -X stuff $'quit\r'</code> | | ||
- | | a full example | <code bash> | + | |
+ | |||
+ | A full example: | ||
+ | |||
+ | <code bash> | ||
# run bash within screen | # run bash within screen | ||
screen -AmdS bash_shell bash | screen -AmdS bash_shell bash | ||
Line 78: | Line 80: | ||
# stuff 'exit\n' to exit bash session | # stuff 'exit\n' to exit bash session | ||
screen -S bash_shell -X stuff $'exit\r' | screen -S bash_shell -X stuff $'exit\r' | ||
- | </code> | | + | </code> |
===== Misc ===== | ===== Misc ===== | ||
| redraw window | ''[[commands:redisplay|C-a C-l]]'' | | | redraw window | ''[[commands:redisplay|C-a C-l]]'' | | ||
- | | enter copy mode | ''[[commands:copy|C-a []]'' or ''[[commands:copy|C-a <esc>]]'' (also used for viewing scrollback buffer) | | ||
- | | paste | ''[[commands:paste|C-a ] ]]'' | | ||
| monitor window for activity | ''[[commands:monitor|C-a M]]'' | | | monitor window for activity | ''[[commands:monitor|C-a M]]'' | | ||
| monitor window for silence | ''[[commands:silence|C-a _]]'' | | | monitor window for silence | ''[[commands:silence|C-a _]]'' | | ||
| enter digraph (for producing non-ASCII characters) | ''[[commands:digraph|C-a C-v]]'' | | | enter digraph (for producing non-ASCII characters) | ''[[commands:digraph|C-a C-v]]'' | | ||
- | | lock (password protect) display | ''[[commands:lockscreen|C-a x]]'' | | + | | lock (password protect) session | ''[[commands:lockscreen|C-a x]]'' | |
| enter screen command | ''[[commands:colon|C-a :]]'' | | | enter screen command | ''[[commands:colon|C-a :]]'' | | ||
- | | enable logging in the screen session | C-a H | | + | | enable logging in the screen session | ''[[commands:logging|C-a H]]'' | |
- | | getting out of the screen session | exit | | + | |
===== Scrollback-buffer ===== | ===== Scrollback-buffer ===== | ||
Line 98: | Line 96: | ||
In copy mode, one can navigate the scrollback buffer in various ways: | In copy mode, one can navigate the scrollback buffer in various ways: | ||
- | | half page up | C-u | | + | | half page up | C-u | | half page down | C-d | |
- | | half page down | C-d | | + | | back | C-b | | forward | C-f | |
- | | back | C-b | | + | |
- | | forward | C-f | | + | |
| cursor left/down/up/right | h/j/k/l | | | cursor left/down/up/right | h/j/k/l | | ||
- |