Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
Screen
Edit
PageHistory
Diff
Info
LikePages
[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. 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. 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. ---- !! Useful tips * You should really read the screen(1) ManPage -- the program is chock full of useful bits. * <tt>screen -rx</tt> allows to to attach to an existing screen session, even if you are already attached to it from another terminal. * 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. * 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. * 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>. * 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>. !!hardstatus This line enables you to have a constant display of what windows are open, to make switching between them faster. Check the 'STRING ESCAPES' section of the screen man page for information on how to build your own one. The one [BenStaz] uses can be seen below. To try it out, simply paste these lines into <tt>~~/.screenrc</tt>. <verbatim> hardstatus alwayslastline hardstatus string "%{.bW}%?%-Lw%?%{.rW}%n*%f %t%?(%u)%?%{-}%?%+Lw%? %= %D %d/%M/%Y %C:%s%a" </verbatim> ---- Links: *[Gentoo Wiki Screen Tips|http://gentoo-wiki.com/TIP_Using_screen]
4 pages link to
Screen
:
x2x
SSHNotes
PTY
TerminalEmulator