Frequently Used Keys
-
Install on CentOS:
yum install sreen -
Show help:
screen -handC-a ? -
Start a new session:
screen -S <session-name>(if a [screen is terminating] error raise, usescreeninstead) -
Create a new window:
C-a c -
Switch between windows:
C-a #where#is the window number -
Detach from a session:
C-a d -
Reattach to an existing session:
screen -r <session-name> -
List all sessions:
screen -ls -
Reattach to a detached session:
screen -r [session-name] -
Switch between windows:
C-a C-a
Copy Mode
Open copy mode: C-a [.
In copy mode, press Space to mark starting point.
Move the cursor (using vi key bindings) to the end point.
Press Space again to copy selected texts. C-a ] to paste texts.
Scroll up/down: in copy mode, C-u/d or C-b/f
Ref: Copy and Paste
Customize Status Line
Add the following lines into ~/.screenrc:
cat ~/.screenrc
startup_message off
hardstatus alwayslastline
hardstatus string "%{= KW} [%1`] %{= Kw}|%{-} %-Lw%{= bW}%n%f %t%{-}%+Lw"
backtick 1 30 30 sh -c 'screen -ls | grep --color=no -o "$PPID[^[:space:]]*"'
Change default escape Ctrl-a
To change Ctrl-a to Alt-q, add the following lines into ~/.screenrc:
escape ^||
bindkey "^[q" command
Ref:
Understanding GNU Screen’s hardstatus strings