XTerm Title



Unset PROMPT_COMMAND

First, make sure that PROMPT_COMMAND is not set, since PROMPT_COMMAND is commonly used to set dynamic xterm titles. The contents of $PROMPT_COMMAND is executed before every primary prompt ($PS1) is displayed.

unset PROMPT_COMMAND

Echo The Right Escape Codes

Change your xterm title in Bash by echoing the title within the following escape sequences:

* Start Xterm Title: \033]0;
* End Xterm Title: \077

Notice that echo is used with -n (no trailing newline) and -e (enable interpretation of backslash escapes).

unset PROMPT_COMMAND
echo -ne "\033]0;TITLE GOES HERE\007"