brownbetty: Tim gazes upon Dick's manly chest.  "Wow!" (Wow)
brownbetty ([personal profile] brownbetty) wrote in [community profile] command_liners2010-07-29 03:37 pm

No one told me about this!

[personal profile] pixel's post below reminded me that I have meant to post this for a while: Screen! Screen seems sort of like the secret weapon of command-line users; somehow it takes one ages to discover it, and if one is not far enough along in one's command-line usage, it just ends up seeming sort of mean-spirited and baffling. It's documented, but it's such a swiss-army knife that it's easy to get lost in the maze of documentation. However, at a certain level of usage, it suddenly becomes the most useful program ever.

So I wanted to ask people their favourite things to do with screen, and to share their .screenrc files, where they've modified them in interesting ways.

I still remember that happy day when I discovered that screen could monitor a background window, and tell me when it changed or stopped changing. The latter was the revolutionary one, for me; I could start something enormous compiling, and then neglect it, secure in the conviction screen would let me know when it finished. If your keybindings are standard, "ctrl-a, _" will monitor for silence, and "ctrl-a, m" will monitor for change/movement.

My screenrc is very lightly customized, a relic of my old machine which would barf and die if asked to update screen too often, but I like it. The interesting entry is
caption always "%{= kw} %-Lw [%n-%f %t] %+Lw %?@%u%?%? [%h]%?"
This gives me a strip at the bottom of the session which lists my windows by name and number, ferrinstance, at this moment:
[0-$ bash]   1$ newsbeuter  2-$ mutt  3$ rtorrent 
where the active window is in square brackets. Mutt has a hyphen after the window because it's the last active window, and the one I'd go to if I used "ctrl-a a" to return to my previous. If one of my windows had produced an alert, I'd get a "!".

You can do some really crazy stuff with the caption command, although the syntax is so arcane it requires years of study. I'm pretty sure most people copy someone else's and fiddle with it to get what they want, rather than attempt to write one from scrap.
pixel: (losers: jensen huh?)

[personal profile] pixel 2010-07-29 10:13 pm (UTC)(link)
It isn't intuitively obvious to the casual observer but the problem is that it's SO flexible it defies simple explanation. I first ran into it while using irssi, where I liked the reconnect feature, but it wasn't obvious from that what else it could be good for.

Care to share more about this nesting concept? I'm not sure I quite get it. (Love the idea of different keybindings on a remote machine)
pixel: Alec the geek. (Leverage) (leverage: hardison geek)

[personal profile] pixel 2010-07-30 12:38 pm (UTC)(link)
Still pretty slick, which reminds me I ought to tinker with my caption more....;)