Quick hack to set the title of a tab in OSX Terminal.app

The ability to have different tabs for different task in the terminal is a blessing when you need to do different, unrelated things from the terminal. However, after a while, I usually find myself cycling through the tabs to find the tab that I am looking for. This is counter-productive. Setting a title to the tab would greatly help.

Doing this normally, would mean either right-clicking on the tab and setting the title or hitting cmd+i, which is alright, but takes a few more clicks/keystrokes than it should. Here is an easy workaround.

add the following to your ~/.profile

function settab {
printf "\e]1;$1\a"
}

Now, every time you open a new tab (or whenever you want!), set the title for the tab like this:

Adamantium:RabbitMqSample vaishaksuresh$ settab GeneralCommands