Possible Duplicate:
Set the title of the terminal window to the current directory

I have many open Terminal shell windows open in Mac OSX.. Just right click on the icon for terminal and choosing one is not easy, because they all have the same title.

Is there a way to change the title of a terminal window so it would always be the current directory the shell is running from?


marked as duplicate by fideli, BinaryMisfit Oct 29 '10 at 16:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Try this: Mac OS X Change the Terminal Window Title

The title of the Mac OS X terminal window can easily be changed. Changing the title can be useful when running a script or when using multiple terminal windows for different purposes in order to identify them easily when switching between applications and windows.

In the terminal window, from a bash prompt (the default shell) or in a bash shell script, use the following command to change the terminal window title to Tech-Recipes rules:

echo -n -e "\033]0;Tech-Recipes rules\007"

You can place (just about) any text in place of “Tech-Recipes rules” including the contents of a variable. Consider the following example:

name=`hostname` echo -n -e "\033]0;$name\007"

This will change the title of the terminal to the hostname of the computer running the shell.

  • oh that's a good direction, thanks. but how do I set it up so every "cd" leads to an echo command in this form? I tried doing alias cd=some_shell_script here_that_cds_and_echos, but it does not work. – osxshell Oct 29 '10 at 16:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.