Screen
A quick overview of the key combinations you’ll use 99% of the time in screen
Screen is a really really handy little bit of software I leave running on all the Linux boxes I run.
From the man page:
DESCRIPTION
Screen is a full-screen window manager that multiplexes a physical ter-
minal between several processes (typically interactive shells). Each
virtual terminal provides the functions of a DEC VT100 terminal and, in
addition, several control functions from the ISO 6429 (ECMA 48, ANSI
X3.64) and ISO 2022 standards (e.g. insert/delete line and support for
multiple character sets). There is a scrollback history buffer for
each virtual terminal and a copy-and-paste mechanism that allows moving
text regions between windows.
It goes on a bit more at length. Anyway, the important thing is that it allows you to have more than one terminal session running in a single terminal and swap between them. You can also disconnect from screen and reconnect at a later date, maybe even from a different location (console as opposed to a remote putty session for example) and all the sessions will still be there, as will any programs running within them!
Brief overview:
| Function | Keystroke |
|---|---|
| Attatch to/start screen | Type “screen -RD” |
| Detatch from screen and leave it running in the background | “ctrl+a d” |
| New Terminal within screen | “ctrl+a c” (created under the privs of the initial user, not the current one.) |
| Swap to a different session | “ctrl+a [0-9]” |
| Swap to previous session | “ctrl+a a” |
| Next session in sequence | “ctrl+a n” |
| Previous session in sequence | “ctrl+a p” |
| Enter Copy mode | “ctrl+a ]” Then move about and highlight with the cursor keys, and hit enter to copy to screen’s clipboard |
| Paste Clipboard | “ctrl+a [” |
Now if you have a screen session running under a screen (eg, ssh from within screen on host a to host b where you’re also running screen) and you want to perform a screen command on the remote screen you have to type ctrl+a ctrl+a
Thats the important commands to remember.
If you use screen -RD to attatch to screen, and someone else is already attatched, then their connection is killed. You can do wierd stuff like shared sessions, but then it gets a bit messy and I’m not going to cover it here.
January 6th, 2007 at 6:40 am
This is a great summary of the screen command. I just wanted to point out one error. The Enter Copy mode is actually “ctrl+a [”. You have it listed as the same as the paste command.
Thanks for the abridged version of the man page. It’s been del.icio.us tagged and will be referenced.