dischord.org » GNU/screen and dynamic titles for SSH

with 3 comments

GNU/screen is one of those applications so immensely useful I seriously wonder how I’d function without it. This post isn’t a tutorial (see here for that), I’m just documenting a particular aspect of my configuration for personal reference as much as anything else.

I use alot of tabs in screen, usually on a per-host and per-task basis. It’s handy therefore to have a proper statusline informing me which host I’m on, or which task is current. As the former changes often I have a couple of bash functions that include the appropriate escape to set the name in screen:

# Set hostname in hardstatus line in screen
if [ "$TERM" == "screen" ]; then
function ssh() {
echo -n -e “\033k$1\033\134″
/usr/bin/ssh $@
echo -n -e “\033k`hostname -s`\033\134″
}

function telnet() {
echo -n -e “\033k$1\033\134″
/usr/bin/telnet $@
echo -n -e “\033k`hostname -s`\033\134″
}

# We’re on localhost
echo -e “\033k`hostname -s`\033\134″
fi

So here’s what it ends up looking like with a few different sessions on the go, with each of the screen names having been set depending on where I’ve ssh’d to. My actual .screenrc is here - there’s not much to it, and it’s mainly bits that have been pinched from elsewhere, such as the hardstatus formatting. One thing worth noting though is that the escape I use for screen is now ‘\’ as opposed to Ctrl-A, this saves a bit of typing on my behalf.

Written by nick

November 22nd, 2006 at 2:06 pm

Posted in Geek, General

Tagged with ,

3 Responses to 'GNU/screen and dynamic titles for SSH'

Subscribe to comments with RSS or TrackBack to 'GNU/screen and dynamic titles for SSH'.

  1. do I type this is at the ‘run’ command off the start bar ?

    ;)

    Glyn

    22 Nov 06 at 2:16 pm

  2. What terminal font is that?

    Gary

    22 Nov 06 at 3:37 pm

  3. It’s called ‘Terminus’, you can grab it here: http://www.is-vn.bg/hamster/jimmy-en.html

    nick

    22 Nov 06 at 4:26 pm

Leave a Reply