How to change gnome-terminal title in Ubuntu 10

installero picture installero · Oct 14, 2010 · Viewed 8.9k times · Source

I've tried setting my PROMPT_COMMAND variable:

PROMPT_COMMAND='echo -ne "\033]0;"myWindowTitle"\007"'

but something changes my tab (or the whole terminal title) to 'user@hostname:/current/path', thus

PROMPT_COMMAND='echo -ne "\033]0;"myWindowTitle"\007" && sleep 3'

changes title for 3 second only :)

Answer

Paweł Nadolski picture Paweł Nadolski · Oct 15, 2010

PROMPT_COMMAND is issued before a prompt is set based on the PS1 variable. Probably you have some character sequence in PS1 which sets your windows title. You may invoke unset PS1 or set it to some other value:

export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

Alternatively you can set window title in your PS1 variable:

export PS1='\[\e]0;myWindowTitle\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$'