Terminal Titlebars

I had this issue recently on a work system where when I would login via ssh the titlebar of my terminal would not be updated to reflect the connection.

For example, suppose my local xterm/gnome-terminal/etc… titlebar usually displays ‘daniel@desktop: ~‘. When I login with ssh to another box this title updates to ‘daniel@laptop: ~‘ (those aren’t my user or computer names, they’re just for illustration purposes). This was not happening on this system.

The fix was easy though. It turned out that the example .bashrc file from /etc/skel/.bashrc was not copied over when my account was created. So I copied it over and now all is fine. πŸ™‚

FYI: The bit of code that sets the titlebar text in the .bashrc file (in Ubuntu) is this:

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}07"'
;;
*)
;;
esac

One thought on “Terminal Titlebars”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.