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
3 Answers
You can use @bubu 's solution, or you can right click on the tab, select "Inspect Tab", and set the title from there.
-
6
-
2Shift-Command-I (Shell > Edit Title) also shows the Inspector and will ensure it selects the Info pane. Aug 21, 2011 at 7:59
-
1As of Mac OS X Lion 10.7, Terminal's Inspector also supports setting the tab title separately from the window title. Aug 21, 2011 at 8:09
-
I came across this post in 2021, I'm on macOS Catalina - @DanielBeck solution is what was most helpful for me. When you do
Cmd-I
you get the inspector window, and in there is a field called "Tab Title." May 13, 2021 at 13:50
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"
-
3
-
1
-
5Note 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). Aug 21, 2011 at 8:02
-
3I 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'
Aug 21, 2011 at 8:07 -
2If 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. Oct 27, 2013 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!