Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 16.04 - Set Terminal Title

It's extremely useful to be able to name your terminals when you are juggling a lot of them as shown below with the title "hello world":

In ubuntu 14.04 you could set a shortcut key, but it looks like you can't do that anymore is 16.04. Luckily, someone posted a solution on Ask Ubuntu.

Simply edit your $HOME/.bashrc file and add the following function:

set-title(){
  ORIG=$PS1
  TITLE="\e]2;$@\a"
  PS1=${ORIG}${TITLE}
}

Now whenever you want to set the title of your terminal, just enter something like:

set-title "my awesome terminal title"
Last updated: 19th February 2020
First published: 16th August 2018