65

Used to be able to right click on the tab and change the title. Not sure how to do this anymore. Just upgraded to Fedora 21.

EDIT: I have switched from gnome-terminal to ROXterm

103

Create a function in ~/.bashrc:

function set-title() {
  if [[ -z "$ORIG" ]]; then
    ORIG=$PS1
  fi
  TITLE="\[\e]2;$*\a\]"
  PS1=${ORIG}${TITLE}
}

Then use your new command to set the terminal title. It works with spaces in the name too

set-title my new tab title

It is possible to subsequently use set-title again (original PS1 is preserved as ORIG).

30

The user title code was removed1 from gnome-terminal 3.14. To set the title, you could use an escape sequence:

printf "\e]2;YOUR TITLE GOES HERE\a"

or e.g. with bash:

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

1: see gnome bug 724110 and gnome bug 740188.

  • 9
    Thanks for a link to the discussions. I guess the answer to this was NO. A funny quote from one of the links: "modern users do not use terminals". LOL. – penner Jan 5 '15 at 19:12
  • This doesn't work for me: Fedora 21, Bash 3.14.3. – kdbanman May 8 '15 at 15:31
  • It works on fc22 also.. – Balaji Perumal Jan 8 '16 at 5:47
  • 3
    Apparently, it's coming back... "Yeah sorry, the --title option is restored in GNOME 3.20 (March 2016 release), which we released half a year ago, but Ubuntu 16.04 shipped with GNOME 3.18 (September 2015 release), which had removed this option." Michael Catanzaro's 2016-09-01 18:41:45 UTC comment #31 (from second bug, 740188) – sage Jan 12 '17 at 22:10
  • 1
    @sage - there is no feature, Michael's comment there is about the --title option which I can confirm that was indeed restored. However, the Q here is about the right-click option to rename the currently open tab - a different issue... – don_crissti Jan 13 '17 at 16:54
17

New versions of gnome-terminal just thrown away most helpful professional features. :-(

I have tried to setup and get an older version of gnome-terminal running and also compared alternatives.

If terminator is too exotic for you, the mate-terminal is a great option! It is a fork of gnome-terminal and just keeps all the good features:

  • you can open multiple tabs from the command line giving them different titles

    mate-terminal --tab -t "aaa" --tab -t "bbb" --tab -t "ccc"
    
  • you can set up a keyboard shortcut (I use Ctrl+Shift-i) to set a title

  • Guake is also not a bad variant – Bunyk Jan 12 '18 at 10:00
1

When you run a resident program like top or ssh, the tab is properly labeled.

gnome-terminal --tab -e top -t "aaa" --tab -e top -t "bbb" 
1

If you're using Ubuntu 16.04 you may need to:

PS1=$
PROMPT_COMMAND=
echo -en "\033]0;New title\a"

I list this an more info about it at link.

0

put this in .bashrc:

function title() { 
  p1='echo -ne "\033]0;' 
  p2='\007"'
  PROMPT_COMMAND=$p1$@$p2 
  p1= 
  p2=
}
0

As an expansion onto @Weston Ganger's answer, if you want to automatically set a title upon opening a new Gnome terminal, then add this to the bottom of your ~/.bashrc:

if [ ! -z "$SET_TITLE" ]; then
    set-title $SET_TITLE;
    export SET_TITLE=;
fi

Then launch a terminal like:

gnome-terminal --tab -e 'bash -c "export SET_TITLE=\"my title\"; bash -i"'

and it will automatically run set-title to apply the title.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.