Normally, when you load a saved session in PuTTY and connect to it, PuTTY will set the window title to the host name of the system you connected to (plus the string "PuTTY").
Now I have many different sessions that all connect to the same host, but on different ports (because the host runs several SSH tunnels on different ports). Therefore seeing the host name is not very helpful, since it's always the same.
So I'd like PuTTY to show the name of the loaded session in the window title. Is there a way to do this?
The only way I could find is to set the window title manually (Window / Behaviour / Window title). But I believe I'd have to do this manually for each session, which is rather tedious.
The solution below seems to solve this problem.
To change the PuTTY SSH session window title (one by one manually by the PuTTY GUI):
To change the PuTTY SSH session window title (for all sessions by command line):
Sources & inspirations:
This function will set the title of your PuTTY window to the given string:
You can use this to set the title from the command line or from scripts, e.g. from within .bashrc.
I was looking for how to make window titles stick when using PuTTY with session files.
So in
.putty/sessions/ServerX
, set a default title and no remote behaviour as:And to give it a special title for some particular purpose, just override the default:
The only other route I'm aware of is to use the xterm emulation features to set the title from the system you are logged into (on Red Hat Linux and SUSE Linux, the Bash prompt is written to the titlebar by default).
See this page for a description of the process and the relevant escape sequence.
You can use the
-loghost "title"
option in Windows - it opens PuTTY with the specified title name. It also changes other stuff, so please check if that's not making any other problem for you.I'm using it with VIRL, and it works perfectly fine.
In Windows, this will set the window title of every session to the very same name of the session:
This is how you can set a custom window title in a command line script, no WinRegistry changes or pre-defined sessions required, script must use
-t -m
options to run a remote commands and stay in a bash shell without an automatic exit.Script is using a
\033]0;...
window title remote command escape syntax.PuttyTestNode1.bat
In Windows, this cmd line will set the window title of every session to the very same name of the session itself: