quick intro to gnu screen (a toy for os x and other nixes)

A weird imagination is most useful to gain full advantage of all the features. --screen manual page.

screen makes a command line session that you can detach from while your apps are still running and come back to later.

...and...you can attach from multiple places at once, share your session, have multiple sub screens, flip between them, split the view between them, get notifications of activity (or lack thereof) on hidden ones... theres way too much built into this...

using screen

most commands begin with control-a and a letter. for example help is C-a ?. to send C-a to a program your running inside screen, C-a a.

session control

new named sessionscreen -S name
list sessionsscreen -ls
detachC-a d
(re)attachscreen -r
attach while attachedscreen -x
detach other sessionscreen -d

screen -x leaves other sessions attached, making multiple windows to the same thing. if you want to detach them use screen -d from outside the screen session or screen -dr to attach while detaching the others.

names for screen sessions are for attaching/detaching when you have more than one. if you didnt name it, you can use the number from screen -ls

scrolling, cutting and pasting

copy mode (scrolling) C-a [
mark textspace
pasteC-a ]

copy mode is mostly used to see the text that scrolled past. you can use arrow keys or vi keys (i,j,k,l) to move around. copy mode ends when you press space the second time or hit esc.

window control

a screen session can have multiple "windows" for multitasking. example, work in one, nethack in another etc...

new windowC-a c
switch windowsC-a 0-9
rename windowC-a A
list windowsC-a "

screens command line

screen has a command line, C-a :, which works like the one in mutt or vi. heres and example of what you can do with it

voyeur and exhibitionist

set up a host so they can just telnet in and watch the show. the screen binary itself will need to be setuid for this to work, so be carefull with it.

/usr/local/bin/loginvoyeur
#!/bin/rbash
login voyer

/usr/local/bin/voyeurshell
#!/bin/rbash
screen -x exhibitionist/shared

/etc/inetd.conf 
telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd -L /usr/local/bin/loginvoyeur

/etc/passwd
voyer::1001:100:,,,:/home/voyer:/usr/local/bin/voyeurshell

then, as exhibitionist, do the following in the screen command line, to add the voyeur, only allow them watch, then let them in

acladd voyeur
chacl * -wx "#?"
multiuser on

stuff that goes well with screen

bitchx
runs on its own screen session so you dont have to
irssi
just a nice irc client.
centericq
multi IM program. you have to check this out if you havent seen it yet
twin
run terminals and other programs in a text display. its kinda like X11 for text terminals
your shell
on flakey dialup

stuff like screen

VNC
similar, but for graphical desktop sessions
dtach
like screen, but much smaller. all it does is detach and session sharing. easier to use.
batch
runs a set of commands and emails you the result. doesnt matter if your logged in or not. thers no way to interact once it starts. comes with mac/unix, just read the man page.
at
like batch but waits for a specific time to run the commands. makes a good alarm clock.

more stuff about screen