Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'ssh hostname in title' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
ssh hostname in title
Authored by: michelj on Oct 09, '09 03:53:35AM

I'm a sysadmin of many servers, and I like keep a lot of terminal windows open. I set the hostname automatically in each window title.

Here is what I've done ( works in 10.5 and 10.6 ):

create the file /usr/bin/ssh.title:
function settitle() { echo -ne "\033]0;$@\007"; }
settitle 'ssh' $1
/usr/bin/ssh $1 $2 $3 $4

make it executable:
chmod 755 /usr/bin/ssh.title

In the "New Remote Connection" window of terminal, add a service (click the left '+' sign)

Service Name: ssh
Bonjour Name: _ssh._tcp.
Command to execute: /usr/bin/ssh.title
Check "Passes username to command"

"ssh" will then appear in the service column. Each ssh window will show the remote hostname in the title.

[ Reply to This | # ]