How to change the Mac Terminal title from the command line

Mac Terminal FAQ: How can I change the title on the Mac Terminal app from the Mac/Unix command line?

I've been working on a project where I have three Mac Terminal tabs open at one time, and I found it was much easier to work this way when I changed the title on each Terminal window. This helped me easily identify what I was doing in each Terminal window.

Changing the Mac Terminal title

The basic escape sequence you need to change the Terminal title from the command line is this:

echo -n -e "\033]0;YOUR TITLE HERE\007"

When you issue this command from the command line of a Mac Terminal window, it will change the title in the Terminal's title bar to "YOUR TITLE HERE."

In the real world ... what I did was label one of my Terminal windows as "CLIENT", one as "SERVER", and the other as "BUILD". I did this by issuing commands like this:

The Terminal title for window #1:

echo -n -e "\033]0;CLIENT\007"

Terminal title for window #2:

echo -n -e "\033]0;SERVER\007"

Terminal title for window #3:

echo -n -e "\033]0;BUILD\007"

Note that you can also create a Unix shell script to make this title process easier, i.e., so you can just type something like maketitle "SERVER". I'll cover the creation of that shell script in a future tip.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.