Well ... it's better late than never. After many years of linux (and unix) administration I finally got to the point to learn
screen
.

To give you a short definition: it's the "terminal service" of the linux/unix commandline with a nice multi-session/-window manager on top of it.

Actually most descriptions (including the manpage) emphasize the multi-window feature, but in my eyes the detach from / reattach to a session is more important.
Aaron Brown's cheat sheet (the attached link of this post) is pretty good, contains more commands than I'll probably use. Nevertheless I'll create my own version so it (potentially) lasts beyond Aaron's (in case he closes his blog) and so I can customize, restructure, extend it, etc.
Command lines:
screen
: Start a new screen session.
screen -D -R
: Attach or create a new session. In detail: if a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user.
All key bindings should be prefixed by
Ctrl + a
(~
C-a
).
(Of course this prefix can be changed).
Most important key bindings:
"
: Present a full-screen list of all windows for selection. Use the arrow or number keys (or Vi- or Emacs-style cursor keys) to highlight a window and press <Enter> to switch to it.
w
: Show a concise list of windows in the message line. Each entry consists of a number, an optional character ("-" marks the previous window, "*" the current window), the window flags, some whitespace and the window title.
<number>
: Switch to a window specified by <number> (can be any digit, ie. 0 - 9).
n
: Switch to the next window.
p
: Switch to the previous window.
c
: Create a new window with a shell and switch to that window.
d
: Detach screen
from this terminal. Do this before you log out. You will be back at the shell you started screen
from.
A
: Allow the user to enter a name for the current window.
?
: Show a help screen (list of current key bindings).
Various other useful key bindings:
h
: Write a hardcopy of the current window to the file hardcopy.n
.
H
: Begins/ends logging of the current window to the file screenlog.n
.
C-a
: Switch to the window displayed previously.
-
: Switch to the blank window.
a
: Send the command character (C-a) to window.
i
: Show info about this window. (eg. character encoding, window number, title)
t
: Show system information.
C-l
: Fully refresh current window.
M
: Start/stop monitoring the current window for activity. When any activity occurs in a background window that is being monitored, a notification is displayed in the message line.
_
: Start/stop monitoring the current window for inactivity.
*
: Show a listing of all currently attached displays.
:number <number>
: Change the current window's number to <number>. If the given number is already used by another window, both windows exchange their numbers. If no argument is specified, the current window number (and title) is shown.
[
: Enter copy/scrollback mode. This allows you to copy text from the current window and its history into the paste buffer. In this mode a Vi-like full screen editor is active.
]
: Write the contents of the paste buffer to the stdin queue of the current window.
Key bindings for regions (ie. split the screen to show multiple windows simultaneously):
S
: Split the current region into two new ones.
tab
: Switch the input focus to the next region.
Q
: Delete all regions but the current one.
X
: Kill the current region.
:resize <number>
: Set current region height to <number>.
Copy/scrollback mode (no
C-a
prefix is required in this mode):
h
, j
, k
, l
: Move cursor left, down, up, right (as in Vi). Regular arrow keys also work.
0
, ^
, $
: Move to the leftmost column, to the first or last non-whitespace character on the line.
C-b
: Page up (<PageUp> key works too).
C-f
: Page down (<PageDown> key works too).
g
: Moves to the beginning of the buffer.
G
: Moves to the specified absolute line (default: end of buffer).
%
: Jumps to the specified percentage of the buffer.
Space
: Set the first or second mark respectively. When the second mark is set, the text between the two marks will be put into screen's paste buffer and copy/scrollback mode will be exited.
/
: Vi-like search forward.
?
: Vi-like search backward.
Esc
: Exit copy/scrollback mode. (Actually all not-bound keys exit copy mode.)
Recent comments
2 years 34 weeks ago
4 years 3 weeks ago
4 years 3 weeks ago
4 years 5 weeks ago
4 years 6 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 14 weeks ago