Disclosed Information

Now you know too.

Disclosed Information RSS Feed
 
 
 
 

Thanks: GNU Screen

During my day at work, I’m usually connected to 2-10 machines at the same time (ssh). The easier it is to manage, the higher than number gets. In the past I was using Gnome’s Terminal with tabs for each connection, and it was just fine. Lately, I’ve been using Windows, and don’t have that luxury, so I started looking for alternatives.

I habitually use putty for all ssh needs, so I found the Putty Connection Manager, which is a silly .NET way of wrapping putty and giving it tabs. It worked OK, but was a little clumsy and had weird saving mechanisms. As I recall, it crashed a couple times, also. I then moved back to my old standard, SecureCRT, but it’s not free, and wasn’t offering me anything that putty didn’t do better, other than tabs.

As my SecureCRT shareware trial expired, I began looking for solutions. I remembered that we have a so-called ‘jump-box’ - a server at our other datacenter that is supposed to be used to ssh into, and then jump off to other machines, so we don’t have to expose ssh to another set of vlans. (paranoid?)

I made this jumpbox my home, and started using screen on it. Screen gets a little unmanageable after 5 or 6 screens are open, and the following it my solution:

In my .screenrc -

hardstatus alwayslastline "%{= KW}%-w%{= wk}%50>%n %t%{-}%+w%<"

This adds the approximation of tabs on the bottom line of the terminal window, one tab representing each screen, containing the tab number and the xterm title in the text on the tab. That leaves me with something that looks like this:

1 bash   2 bash   3 bash   4 bash   5 bash

To give them useful titles, I added this to my .bashrc:

function ssh() {
    echo -n -e "\033k$1\033\134"
    /usr/bin/ssh $@
    echo -n -e "\033k`hostname`\033\134"
}

Now, when I ’ssh’ somewhere in a screen, it sets the title to the hostname. It’s perfect. Thanks go to an “anonymous” upload from spam@sweet.as on dotfiles.org.

Leave a Reply

 

May 2008
M T W T F S S
« Mar   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

listening..

  • Loading...

pics

www.flickr.com