One of the frequently asked questions in our line of work is how to set the titles of Xterm windows. Especially when we have so many xterm windows 
In the above picture, Can you tell which user, machine and directory in which the following sessions are? There are only two options: either look at each icon manually or remember it.
What if you could influence the titles of each xterm window? Good news is, we can.
The answer is available freely on the internet: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html
If we add this to $HOME/.kshrc (assuming KSH is the shell being used), the information that is constant throughout the lifetime of the shell.
echo "\033]0;${USER}@${HOSTNAME}\007"
This is how it will look after this is done. 
PS: The hostnames are totally fictional and do not represent any real server names
A Better method - Thanks Laurent Schneider
Laurent showed a better wayThe problem with echo is that it is run only once. That means, if you
are on usellx42 and do ssh usellx41, the header will change to
usellx41. But when you log off, the title will not be reset and will be
misleading (usellx41).
My approach is to set in in PS1, so that it will always be correct.
Ex in .kshrc
PS1=$(echo -e "\033]0;${USER}@${HOSTNAME} \007 ${USER}@${HOSTNAME}$ ")
Cheers,
Laurent

Comments (3)
The problem with echo is that it is run only once. That means, if you are on usellx42 and do ssh usellx41, the header will change to usellx41. But when you log off, the title will not be reset and will be misleading (41).
My approach is to set in in PS1, so that it will always be correct.
Ex in .kshrc
PS1=$(echo -e '\033]0;$USER@$HOST\007$USER@$HOST $ ')
Cheers,
Laurent
Posted by Laurent Schneider | September 6, 2007 3:03 AM
Posted on September 6, 2007 03:03
Thanks a lot for your comment, Laurent.
I appreciate you going through the posting and suggesting an improvement. I have taken the liberty of posting it along with crediting it to you.
If you would like to author some articles of general interest, Please feel free to let me know and you are author them on the blog.
Thanks
Gaurav
Posted by Gaurav Verma | September 6, 2007 10:24 AM
Posted on September 6, 2007 10:24
unfortunately, the backslashes before 033 and 007 disappear in my example
Posted by Laurent Schneider | September 7, 2007 12:51 AM
Posted on September 7, 2007 00:51