Monday, 11 June 2018

macos - Change Terminal Title in Mac OS X


How can I arbitrarily change the title of a Terminal window in Mac OS X? I have seen this question and this magicwrap thing, but think it's just a simple Mac OS X command.



Answer



This article tells you how.


Essentially, you use character sequences echoed to the screen to inform the terminal of what title it should display.


title='My first title'
echo -n -e "\033]0;$title\007"

In the above example, whatever the variable title is set to while become the terminal's title. Of course, you could just have the title in the string to echo such as:


echo -n -e "\033]0;My first title\007"

But the first way makes it a slightly bit easier to use and/or extend later.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...