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.
bashcommand line
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.
Best Answer
That uses an XTerm control sequence.
echo
with-e
interprets certain sequences in the string given, in this case\033
became Esc, and\007
is the ASCII bell character (seeman 7 ascii
).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
being^]]
, thePs
in this case is0
, which setsPt
, in this caseNEW_TITLE
, as the terminal title.Related: