how to set the title of a terminal on ubuntu 16.04


how to set the title of a terminal on ubuntu 16.04

Adding a title on ubuntu terminal can be achieved with the two steps mentioned below


step1
open the bashrc and add the below lines

set-title(){
  ORIG=$PS1
  TITLE="\e]2;$@\a"
  PS1=${ORIG}${TITLE}
}
# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

step2
on a terminal enter set-title "Some Title" and click on enter key

Comments