Scott Watermasysk

Still Learning to Code

Setting a Tab Title in Terminal

I have been spending a lot more time in terminal recently. I routinely find myself having more tabs open than I can keep track of.

I then end up forgetting what’s open and end up opening even more tabs which just make the problem worse.

I finally got tired of this and posted a quick question on Twitter. While waiting for a twitter response, I figured I would finally checkout SuperUser which of course had the answer.

You just need to execute the following command:


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

Since there is no way I will remember that command (and who should) I wrapped it in a function that I can put in my .bash_profile.


function title(){
	echo -n -e "\033]0;$1\007"
}

Now, in any tab, I just need to execute:


title 'My Tab Title'