John Siu Blog

Tech - Business Tool, Personal Toys

Screen Command

☰ Table of Content

Cheat sheet.


Start and Exit

CommandUsage
screenStart a screen session with a window with a shell. Start a new window if already in a screen session.
exitExiting the shell will exit the current window. Screen session will also end if it is the last window.
screen <program>Start a program within a screen window. Exiting the program will also terminate the window.

Hot Key

Screen default hot-key is ctrl+a, then follow by a command key. Following are some frequently used command keys:

Press ctrl+a, then press one of the following keys.

Command KeyUsage
?Display help.
cCreate and enter a new window.
"List and choose window.
AChange name / title of a window.
SSplit the terminal.
QRemove all split areas other than the current focused one.
XRemove the currently focused split area.
ctrl+ICycle cursor focus through split area.
0 1 2 3 4 5 6 7 8 9Quick switch between window 0-9.
kKill current window.
dDetect the screen session.
ctrl+\Kill all windows and exit screen.

Command Line Options

Some frequently use command line options:

1
screen <option>
OptionsUsage
-lsList socket name and status.
-DIf inside a screen session, will detach the session and terminate the terminal process with it.
-r <socket>Re-attach to a detached screen session.
-x <socket>Join a screen session.
-SSet socket name other than <pid>.<tty>.<host>.

John Siu

Update: 2020-08-17
comments powered by Disqus