Saturday, 14 October 2017

add title to Ubuntu terminal in 16.04

Open terminal


sudo gedit ~/.bashrc

paste below code in end of the file
--------------------
# function to set terminal title
function set-title(){
  if [[ -z "$ORIG" ]]; then
    ORIG=$PS1
  fi
  TITLE="\[\e]2;$*\a\]"
  PS1=${ORIG}${TITLE}
}
# end of function

-------------------

save and close the file

source ~/.bashrc

Now use set-title command to add title any terminal

set-title "MY Title name"


No comments :

Post a Comment