Change the window name for putty

Hi everyone ,

Happy new year !

I have a question , hope someone will respond to me .

I will be logging into so many servers in the same putty . So , whenever i loggedoff and loggedin into anonther server , putty window will change accordingly to the server name .

If the above is not clear . hope it will be clear with below example .

Example : I will login into the putty , then i have logged into one server , say SERVER1 so here putty window name should change as SERVER1 , then i logged off from SERVER1 and logged into SERVER2 , now the putty window name should change to SERVER2 .

Thanks in advance .

In the setup of your session go to

Windows -> Behaviour
in the right frame you can setup the Windows Title, just put the name of the server corresponding to the session and save your session.

PUTTY obeys the same escape sequences as xterm does to change its window title, so if your window titles aren't changing already, you can get PUTTY to do so easily enough. Try this code in any of your PUTTY terminals:

printf "\033]0;asdf\007"

It should set your window title to asdf. You can put that code in your PS1 variable as shown here so it changes the title every single time your shell prompts you.

If printf from the prompt didn't work, that means your prompt is already changing your window title every single line, changing it back before you could see.

Yes .. it worked !!!

Thanks man .. :slight_smile:

1 Like

Hi Guys ,

I have added like the same in my PS1 . Today i have encountered a problem like
1.its not working for all servers and :wall:
2.the window title is not changing even i logged out also :frowning:

Please help me in this also ..

\033]0;jchada@lpdma561\007

see after logging into servers , this escape character is not working . Hope I am clear with my issue.

Different shells use PS1 in different ways. The same code may not work identically everywhere. Look at the different examples for different systems and shells in that link.

Some systems may be trying to change your window title already, too. Try leaving it out of PS1 and trying the printf line I gave you earlier. If it doesn't work, something else is changing your window title every line...

kewl man .. its working with printf .

Thanks a lot dude !!