XTerm Escapes

You can modify the title of an XTerm window by printing a certain escape sequence.

echo -n $'x1b];'$USER@$HOSTNAME:${PWD/#$HOME/~}$'x7'

The following command will force your bash to update the title after command execution:

PROMPT_COMMAND='echo -ne "\033]0;${USER}: ${PWD/#$HOME/~}\007"'

Feedback is always welcome! If you'd like to get in touch with me concerning the contents of this article, please use Twitter.