Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to name a terminal window or even better give each tab a name. at the moment they just get the underlying process name : for example a tab running elasticsearch gets the name java

share|improve this question
    
superuser.com/q/343747/504387 – Wildcard Dec 23 '15 at 5:14
up vote 9 down vote accepted

You can use @bubu 's solution, or you can right click on the tab, select "Inspect Tab", and set the title from there.

share|improve this answer
5  
Or press Cmd-I to get the inspector. – Daniel Beck Dec 18 '10 at 5:16
2  
Shift-Command-I (Shell > Edit Title) also shows the Inspector and will ensure it selects the Info pane. – Chris Page Aug 21 '11 at 7:59
1  
As of Mac OS X Lion 10.7, Terminal's Inspector also supports setting the tab title separately from the window title. – Chris Page Aug 21 '11 at 8:09

Well.

echo -n -e "\033]0;In soviet russia, the title bar sets you\007"

will set your title to "In soviet russia, the title bar sets you"

share|improve this answer
3  
Or, even shorter, you can use echo -ne instead of echo -n -e. – Wuffers Dec 18 '10 at 4:03
1  
Seems to me that the soviet russia jokes are not well received here... – bubu Jun 7 '11 at 1:23
4  
Note that "0" sets both the window and the tab title. As of Mac OS X Lion 10.7, you can set them independently, using "1" (tab title) and "2" (window title). – Chris Page Aug 21 '11 at 8:02
3  
I recommend using printf instead of echo, because it's simpler and more portable (the "-n" option is not defined in POSIX): printf '\e]0;...\a' – Chris Page Aug 21 '11 at 8:07
2  
If you're interested in how this works, it uses an XTerm escape sequence (also known as a control sequence). A full list of sequences is available here. – TachyonVortex Oct 27 '13 at 9:29

If you do this frequently, you can make @bubu's answer a function in your bash_profile, like so:

tab() {
    echo -ne "\033]0;$*\007"   
}

And then just call it followed by the tab name, e.g. tab Tab Title with Spaces!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .