Specify Tab Names in Terminal

I have about a half dozen hosts that I ssh to on a regular basis. I often end up with multiple tabs, and it’s very helpful if the tab label indicates what machine I’m connected to. Using iTerm’s bookmarks, this works as desired with the bookmark name showing up as the tab name.

It took me a while, but I figured out a way to achieve the same result using the updated terminal program that ships with Leopard. With the new terminal it’s straight-forward to save connections that automatically ssh to the desired host, and also display the remote system’s name as the window title. Unfortunately, there’s no obvious way to override the tab label, which displays the shell name.

My solution is kind of crude, but it does work. Simply create a hard link to the ssh binary with the name of each remote system you need to connect to (symbolic links don’t work; ssh is still displayed). Then, while running terminal, copy one of the existing terminal templates and modify it as you normally would to change colors, etc. After that, in the shell settings tab, substitute the remote-name link you’ve previously created for “ssh.” An example makes this more clear:

instead of “ssh -l username remote-name” specify “remote-name -l username remote-name” and voila’, the remote system name is now displayed in the tab label.

Here’s the command to create the links as needed:

sudo ln /usr/bin/ssh /usr/bin/remote-name

2 thoughts on “Specify Tab Names in Terminal”

  1. hey there…

    Under OS X 10.5.8, I see my tab name briefly change to the name of the link, i.e., the name of the remote machine, but then it switches right back to “ssh”.

    Curious if you are seeing this too, or if you are still having success with the method you described.

    Any idea what could cause what I’m seeing?

    -billc

  2. Not sure what’s causing your problem, but I found that the following works quite nicely for keeping the working directory in the tab title – maybe you can adapt it to what you want to do

    export PS1=”$(echo -n -e “33]0;w07″)w $”

    -Ivan

Comments are closed.