5

Say I have this as my PS1

PS1='\[\e]0;TITLE\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

it will give me this prompt

Steven@Steven-PC ~
$

with a window title as TITLE

I understand that this part

\e]0;TITLE\a

creates the title, but I don't understand why. It just seems like some gibberish.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Zombo
  • 1
  • 62
  • 391
  • 407

1 Answers1

8

The terminal driver looks for output containing that specific code (\e]0;)and uses everything up to the \a as the terminal window title.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358