Titling tabs in Terminal

Solution 1:

In Preferences choose the windows tab for your set of settings. There is an option Active process name - if this is not ticked then you should not see the command in the title bar.

Solution 2:

I turned off, 'show active process' in preferences. Along with all the other trivia. I want different trivia.

As an example, I have the following two lines in my .bash_profile in my home directory. (.bash_profile gets executed in every new tab/window)

PROMPT_COMMAND='echo -n -e "\033]0;`basename $PWD`\007"'
function vi { echo -n -e "\033]0;vi $1\007" ; vim $1 ;}

The first command sets the tab to the last directory in my current bath. e.g. if I'm in ~sherwood/foo/bar this will be bar

The second one in effect turns vi (my editor of choice) into a pair of commands that does the same sort of echo, but now it sets the tab to show that I'm editing this file. So if I'm editing ~sherwood/foo/bar/baz, it will show vi baz

Note that it will show whatever you told vi. So if you type vi /some/long/path/to/a/../../name that's what the tab will show, or at least as much of it as will fit.

At this time I have not found a way to set the title bar differently from the tab.

Solution 3:

You could install xtermcontrol (also via fink, macports, etc.), and then use that to set the title to whatever you want. I have the following cd in my .bash_profile, so that any time I change directories the directory is in the xterm window title:

cd() {
  if [ -n "$1" ]; then
    builtin cd "$@"; xtermcontrol --title "$@"
  else
    builtin cd ~;  xtermcontrol --title "~"
  fi
}

You can also set up aliases or customize your ssh settings so that hostnames are added to the title when you leave this host, etc.