I've searched for a way to change terminal title and found this bash command:
echo -ne "\033]0;NEW_TITLE\007"
It works as it have to, but i'm now interested in what this "magic symbols" mean and how it works.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
An Esc (represented as
^]) followed by
] is, in XTerm parlance, an Operating System Control code. Terminals which support it interpret it as given in the above link:
OSC Ps ; Pt ST OSC Ps ; Pt BEL Set Text Parameters. For colors and font, if Pt is a "?", the control sequence elicits a response which consists of the con- trol sequence which would set the corresponding value. The dtterm control sequences allow you to determine the icon name and window title. Ps = 0 -> Change Icon Name and Window Title to Pt. Ps = 1 -> Change Icon Name to Pt. Ps = 2 -> Change Window Title to Pt.
Ps in this case is
0, which sets
Pt, in this case
NEW_TITLE, as the terminal title.