Friday, March 23, 2012

How to change Gnome-Terminal (tab) title from the command line

With lot of terminals opened it is quite hard to choose the right one..
Also with terminal tabs (ctrl+shift+t) would be useful to have a per tab title.

To do so you have to comment a line into your ~/.bashrc and in particular where it says
# If this is an xterm set the title to user@host:dir
comment with a '#' the line

PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"

after that you can install xtitle
sudo apt-get install xtitle
and then use
xtitle newtitle 
or do it manually with
echo -en "\033]2;newtitle\007"

enjoy

2 comments:

  1. nice! it works wonderfully. Do you know how to also display the tab's job? like "~/workspace (python)"

    ReplyDelete
    Replies
    1. You probably have to play with the PS1 variable in .bashrc!

      Delete

Note: Only a member of this blog may post a comment.