I started using screen wicked late in my exposure to unix. I first encountered it when I inventoried the setuid programs on my linux box, and promptly decided that it couldn't possibly be worth the hassle. How wrong I was....

Instead of using a tabbed xterminal, I just use screen to manage my shells inside of one basic xterm (like rxvt). Screen can provide tabs should so desire, in my screenrc below, I keep a list of the open shells at the bottom of the terminal.

# don't nag me
startup_message off

# don't blink at me
vbell off
vbell_msg ""

# sanity
# pressing CTRL-A CTRL-4 yields ^\  
# which is too close to switching to window 4 for comfort
bind ^\
# no disassemble!
bind k
bind ^k

# setup for macros
setenv PATH $PATH:$HOME/etc/screen/macros

# show the "tabs" at the bottom of the terminal
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.wk}%w"
# tab titles are the first word of the command
shelltitle "$ |sh"

To run a macro script (written in whatever language you want and stored in ~/etc/screen/macros/. ), use the following to drop the output of the script into your current screen window. This rocks for frequent router debug statements that you'd like to codify.

^A:exec !! name_of_your_script with whatever args you want

To enable the auto update tab title hack, your shell prompt needs to send a flag to screen:

# screen fix for bash
ps $PPID | grep -q -i SCREEN
if [ "$?" = "0" ]; then  
	export PS1='\[\033k\033\\\]'${PS1}
fi

Lots of people use screen to manage long-running terminal applications, like IRC or email clients on remote servers. Should their connection die, they can just reconnect to the server and restore the screen session (even though the controlling terminal fell over, it still keeps the child terminal applications alive and managed). Occasionally, I'll use it for long-running compiles or debugging, since I can "daemonize" the process by just disconnecting and then restoring it when the process/build starts nuking Tokyo from afar and a curious me wants to see what's going on.

In the bigger picture, I try to keep my computing environment as cross-platform as possible. Cygwin goes a long way towards making that possible, so I thank the Cygwin team for all their work.


Sweet baby Jesus! I didn't know that screen had been ported to cygwin. Installing at this very moment... No more having to pkill pine after Comcast hoses my connection. Yay! -- Liam