Argh, so many answers...
I tried wmctrl, which almost worked, except I couldnt get it to change the icon title, at least not permanently.
The solution is that PS1 in ubuntu sets the title.
The default PS1 is
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
... which sets the title in the first escape sequence.
Thus, there are two solutions:
Solution 1: simplify PS1, then use PROMPT_COMMAND
Change PS1 to something simpler:
PS1="\u@\h:\w\$ "
... then use the PROMPT_COMMAND:
PROMPT_COMMAND='echo -ne "\033]0;SOME TITLE HERE\007"'
Solution 2: directly modify PS1
Simply modify PS1 with new title:
PS1='\[\e]0;newtitle\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
gnome-terminal --load-configtogether with this script I've written. – halfer Apr 13 '14 at 1:29# set title of current terminal setTerminalTitle(){ echo -ne "\033]0;${1}\007" } alias termttl=setTerminalTitlenow you can use termttl alias for setting title e.g.termttl askubuntu– pmu Oct 11 '15 at 5:33