Penguin
Annotated edit history of Screen version 15, including all changes. View license author blame.
Rev Author # Line
3 AristotlePagaltzis 1 [Screen | http://www.gnu.org/software/screen/] is an unusual and highly useful TerminalEmulator. It allows you to run interactive console programs in a [Screen] session that persists even if you close the terminal window or [SSH] session you started it in. In fact, you can later reattach to the [Screen] session. The programs running inside are never affected in the least.
2
3 You might f.ex start a MailClient or an [IRC] client inside a [Screen] session on a server. You can use [SSH] to connect to that server from anywhere and and take control of the session, never having to close the programs running inside that session. This is particularly useful if you only have physical access to a machine with a flaky connection (such as dial-up or dynamically-assigned [IP]) but have an account on well-connected machine. By running clients in a [Screen] session on that server you can avoid them dying every time you lose your connection.
4
4 JohnMcPherson 5 You might also be interested in Xnest(1) combined with xmove(1), which does a similar thing for [GUI] apps -- xnest provides an [XServer] inside another XServer, and xmove can change the display of running [X11] applications - ie redirect them to another X server.
3 AristotlePagaltzis 6
7 ----
8
9 !! Useful tips
10
6 AristotlePagaltzis 11 * You should really read the screen(1) ManPage -- the program is chock full of useful bits.
3 AristotlePagaltzis 12 * <tt>screen -rx</tt> allows to to attach to an existing screen session, even if you are already attached to it from another terminal.
5 PerryLorier 13 * If you use Ctrl-A a lot and don't like screen catching this, you can change the key used for this by adding <tt>escape ^ss</tt> or similar to <tt>~~/.screenrc</tt>. The first character, <tt>^s</tt> defines the escape char, the second character is what you press after an escape to send a literal escape sequence.
7 DavidHallett 14 * The documentation is not quite clear on how to launch processes into new windows in a running [Screen] session. The <tt>-m -d</tt> switch combination advertised for launching processes in detached mode creates an entire session for each of them. If you want them running in an existing session, you have to send that session the <tt>screen</tt> command. Sending commands to a session from the [Shell] is done by invoking <tt>screen -X ''command''</tt>. Effectively, this means that you launch a batch of wget(1) downloads in a screen session by invoking <tt>screen -X screen wget ''$someurl''</tt> in a loop.
15 AristotlePagaltzis 15 * If you su to a user (because you can't SSH/login as them directly, ie "I am stealing their IRC session") and then get a message like "<tt>Cannot open your terminal '/dev/pts/7' - please check</tt>", you need to change the permissions on your terminal __before__ the su, so you can write to it from the new user: <tt>chmod 666 `tty`</tt>.
12 DeanEvans 16 * If you would like to send commands to a screen session inside another session you can run into issues, as the first screen will capture the commands. To pass a command to the inside session first do <tt>C-a a</tt> this does a literal C-a, passing it to the inside screen session, or any other application you need to pass C-a to. IE to detach from the inside session <tt>C-a a d</tt>.
13 BenStaz 17
18 !!hardstatus
19 This line enables you to have a constant display of what windows are open, to make switching between them faster.
20 Check the 'STRING ESCAPES' section of the screen man page for information on how to build your own one.
15 AristotlePagaltzis 21 The one [BenStaz] uses can be seen below. To try it out, simply paste these lines into <tt>~~/.screenrc</tt>.
13 BenStaz 22
23 <verbatim>
24 hardstatus alwayslastline
25 hardstatus string "%{.bW}%?%-Lw%?%{.rW}%n*%f %t%?(%u)%?%{-}%?%+Lw%? %= %D %d/%M/%Y %C:%s%a"
26 </verbatim>
12 DeanEvans 27
28 ----
29
30 Links:
31 *[Gentoo Wiki Screen Tips|http://gentoo-wiki.com/TIP_Using_screen]