How to change Gnome-Terminal title?

Alternatives:

  • There are other ways however, you can also issue

    gnome-terminal --title="SOME TITLE HERE"
    

    This might not give the desired effect since there is a big chance that your .bashrc overwrites that behaviour.

  • Bringing us to the last method, which I shamelessly ripped out of my .bashrc.

    PROMPT_COMMAND='echo -ne "\033]0;SOME TITLE HERE\007"'
    

As an extra reference, this is the particular line in my .bashrc

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

You may also need to comment this code out in your ~/.bashrc

case "$TERM" in
xterm*|rxvt*)
    # JEFFYEE REMOVED because it makes commands to title() not work
    #PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

Ward's answer is great if you want to set your title based on what host you're on etc every time you open a terminal. If you just want to quickly set a title though, you can just run echo by itself:

echo -ne "\033]0;SOME TITLE HERE\007"

or make a simple function (inside your ~/.bashrc), say termtitle

termtitle() { printf "\033]0;$*\007"; }

which you can run with termtitle some title here.


If you use the Vim editor, you can also enable this option in your vimrc:

:set title

which is disabled by default. It will set cool terminal titles showing the filename which you are editing at the moment and some other things.