Set terminal title in Ubuntu 16

Create a function in ~/.bashrc:

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

Use below command to set the terminal title.

set-title name

Example :

  1. set-title Gurudath
  2. set-title Gurudath Workplace

Reference link: https://askubuntu.com/questions/774532/how-to-change-terminal-title-in-ubuntu-16-04