Automatic PuTTY window title

One of the guys in the team seems to have discovered a neat trick with PuTTY that i certainly didn't know that has proven quite useful.

Normally when you ssh to a server the window title defaults to the host name you ssh'd - unless you set an explicit window name in the putty settings - this works fine and if you save all your config it all works out nicely.

However in our setup we are often logging on to one server to use as a hop to get to other servers - this means the title says one thing but we're actually on another server - this can cause confusion.

We could remember to manually type this entry every time we switch servers in this way but that's a real pain.

It turns out there is an automatic way - don't really understand why it works - but it does.....

If you add this string to the .profile of the use logging on (or indeed just run it directly) it changes the title

printf "\033]0;$HOST\007"

that assumes you have a variable called HOST on your linux platform - you could just set any old alue you like though and give it some friendly name - here is an example

 printf "\033]0;This is what i want in title\007"

which then does this

Thanks to Neil for that little nugget!


Post a Comment