Mac Terminal title - Change the Mac Terminal title from the command line

Mac Terminal title tip: How to change the Mac Terminal title from the Terminal command line.

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

Changing the Mac Terminal title

The basic escape sequence you need to change the Mac 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:

Mac Terminal title for window #1:

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

Mac Terminal title for window #2:

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

Mac 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 Mac Terminal 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.

Post new comment

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