Ubuntu – Can no longer set terminal title in Ubuntu 16 (gnome-terminal)

16.04command linegnome-terminal

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?

Best Answer

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.

Related Question