Friday 28 October 2011

Setting the window title in Putty

There are two ways to set the window title for a Putty ssh client. Statically and on the fly. Both have their uses depending on what you want to achieve.

Static window title
Statically is easy - and is best for naming a connection eg "Web server" so you know where the connection goes. There are two settings you need to change in the putty configuration screens.

1. Under Terminal -> Features tick to disable remote window title changing (to stop the remote server changing what you set)
Disable remote updates to window title
 2. Under Window -> Behaviour enter the new title you would like to see for that connection.

3. Your putty window will now have a fixed title (assuming you remember to save the setting - if not it will only last for this session)
Dynamic window title

Sometimes though you want to change the window title on the fly - or set it from the server rather than set it manually on each clients computer. In this case the following command will let you change the window title from within the Linux shell:

export PROMPT_COMMAND="echo -ne '\033]0;Dev Server - Compiling \007'"
The most obvious way to use this is to type it straight into the shell (or write a script to do it for you) which is what I did in the screenshot below. The other option is to add it to .bashrc which will allow you to pre set the window title for any users you wish or include it in any scripts that take a long time to run so you can glance at the window title on your task bar to see how far along it is.




No comments:

Post a Comment