9

In Ubuntu 14.10 LTS, I was able to set a terminal tab's title simply by right-clicking and choosing Set Title. This was using the default terminal application, gnome-terminal.

In Ubuntu 16.04 LTS, I can no longer set the title, and the terminal application is still gnome-terminal. The option Set Title is no longer in the menu.

Was this feature removed sometime between 14.10 and 16.04? How can I set a terminal tab's title in Ubuntu 16.04?

1
  • How I couldn't find the original in my searching, I don't know. Thanks to those who found it! May 26, 2016 at 16:32

1 Answer 1

19

The option to set the terminal title has been deprecated in 16.04 LTS, however there is still a way to set the title. Edit your ~/.bashrc file and add the following lines:

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

After that close and reopen the terminal or source your .bashrc (command: source ~/.bashrc) and you can set the title by simply typing:

set-title "<title>"

The solution I found here and using it myself since I run on 16.04 LTS.

5
  • Probably yes, just test it, as it only screws the actual open terminal in the worst case you should be safe for testing
    – Videonauth
    Sep 9, 2019 at 17:32
  • Somehow it just has no effect when run from inside my other script .. but only when run as a command in the shell directly .. will check some more (LTS 18.04)
    – matanox
    Sep 9, 2019 at 17:40
  • 1
    Probably because your script is running in a subshell.
    – Videonauth
    Sep 9, 2019 at 17:47
  • Bingo. that solved it. need to source the script rather than execute it normally as a sub-shell. many thanks!!
    – matanox
    Sep 9, 2019 at 17:53
  • It messes up with long statements Sep 30, 2019 at 9:52

Not the answer you're looking for? Browse other questions tagged .