Change putty title window?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Change putty title window?
# 8  
Old 03-02-2007
Computer

Quote:
Originally Posted by akbar
Is it possible to change the putty window title from a Unix command line?
Yes it is. See my posting https://www.unix.com/unix-for-dummies-questions-and-answers/35518-name-path.html . See functions "wt" and "it". My example is for bash, but the functions are copied verbatim from my .kshrc file. So you can do it from bash or ksh.

Once you put one of the functions (eg, "wt") in your startup script (or put it in a file called "wt", or just enter it directly in your command line), you can do:
Code:
wt "Here is my NEW title"

and it will put "Here is my NEW title" in your putty window's title bar.

This makes it easy to do Fancy Shell Tricks like setting your window titlebar to be your hostname, pathname, username, silly joke, or whatever you want, dynamically.

I double checked using Putty 15 seconds... no 17... no 20... no 24... no, ...well, anyway, just now, and I can guarantee that it's more than doable. It's being done! Smilie
-Mschwage
P.S. If you do copy-n-paste my functions, make sure you turn ^[ into a real Escape character, and ^G into a real control-G character. Do that in vi by:
  • deleting the two characters
  • hit escape key
  • hit i (for insert mode)
  • hit Control-V keypair
  • Hit Escape key for ^[, or hit Control-G keypair for ^G
  • Hit the escape key again. Voila'! You've inserted a control-character.
  • Inserting a control character in your command line is left as an exercise for the reader. Smilie

Last edited by mschwage; 03-02-2007 at 06:46 PM..
# 9  
Old 03-03-2007
Quote:
Originally Posted by mschwage
Yes it is. See my posting https://www.unix.com/unix-for-dummies-questions-and-answers/35518-name-path.html . See functions "wt" and "it". My example is for bash, but the functions are copied verbatim from my .kshrc file. So you can do it from bash or ksh.
Thank you Mschwage - Your well documented suggestion worked very well.


Grial, thank you for your help as well, but I wasn't able to get your suggestion to work.
# 10  
Old 03-05-2007
mschwage, thanks for that bit of code.
# 11  
Old 01-18-2008
Quote:
Originally Posted by mschwage
Yes it is. See my posting Name of path - The UNIX Forums . See functions "wt" and "it". My example is for bash, but the functions are copied verbatim from my .kshrc file. So you can do it from bash or ksh.

Once you put one of the functions (eg, "wt") in your startup script (or put it in a file called "wt", or just enter it directly in your command line), you can do:
Code:
wt "Here is my NEW title"

and it will put "Here is my NEW title" in your putty window's title bar.

This makes it easy to do Fancy Shell Tricks like setting your window titlebar to be your hostname, pathname, username, silly joke, or whatever you want, dynamically.

I double checked using Putty 15 seconds... no 17... no 20... no 24... no, ...well, anyway, just now, and I can guarantee that it's more than doable. It's being done! Smilie
-Mschwage
P.S. If you do copy-n-paste my functions, make sure you turn ^[ into a real Escape character, and ^G into a real control-G character. Do that in vi by:
  • deleting the two characters
  • hit escape key
  • hit i (for insert mode)
  • hit Control-V keypair
  • Hit Escape key for ^[, or hit Control-G keypair for ^G
  • Hit the escape key again. Voila'! You've inserted a control-character.
  • Inserting a control character in your command line is left as an exercise for the reader. Smilie
I am new to this forum and hope I am placing this in the correct spot....

I have implemented the solution mschwage described in his post; ie

wt ()
{
echo -n "^[]2;${@}^G"
}

This method is awesome!!!!

The reason I am posting this message is to get your assistance with another issue I am runing into in respect to the window title.

This issue is - after putty'ng to system (A) the window title changes appropriately... While logged into system (A) I run "ssh user@B" via the command line. This now changes the title to system (B)'s name. So far everything works as expected, until I exit system (B). The result is the the window title still reflects system (B).

How do I get the window title to change back to system (A) on exiting system (B)? I'd like this to be automated.

Thanks!!!!
# 12  
Old 01-19-2008
Perhaps write another function, e.g. myssh, to run ssh (pass in parameters) and then call wt to reset the window title.
# 13  
Old 01-28-2008
Putty Title...

Quote:
Originally Posted by Ygor
Perhaps write another function, e.g. myssh, to run ssh (pass in parameters) and then call wt to reset the window title.
Thanks, this will work but I was looking for something that was more transparent to other users. The idea of SSH as an alias was mention by "Smiling Dragon". I think this would work but I'd have to test it out.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Getting command output to putty window title.

Hi, Last 2 weeks I have searched many forums and i haven't found the answer for the question: How to get all command output to Putty title? Needed it for other programs to know when some jobs on a server is done and is it done right or wrong. Plink stdout and stdin wasn't working, i used many... (1 Reply)
Discussion started by: domagaj
1 Replies

2. UNIX for Dummies Questions & Answers

Change putty title name

Hello all, I have a not so unix question for you guys(or maybe it is). I use PUTTY to login to serverA (my putty title shows as serverA.domainname.com) Now from ServerA i do ssh user@ServerB (i have ssh public private key setup)... now my question is when i do ssh and logon to... (20 Replies)
Discussion started by: abdul.irfan2
20 Replies

3. Shell Programming and Scripting

Remotely setting putty window title

I have successfully used a script to modify putty's window title for many years. It has worked great in a Solaris 10 environment, using, sh, bash and tcsh. But I've never been able to get it to work in linux :( The script relies on sending escape sequences via gnu echo. The version of echo on... (4 Replies)
Discussion started by: tsreyb
4 Replies

4. UNIX for Advanced & Expert Users

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... (7 Replies)
Discussion started by: radha254
7 Replies

5. Linux

how to insert a title into a window in kshell

hi all, i am using a Ubuntu work station. i have following piece of code that works ok. But i cant figure out a way to insert a string call $Name into the title of the window i am opening. As you can see, i tried two different ways without a success. Can someone please help me out here? :( ... (3 Replies)
Discussion started by: usustarr
3 Replies

6. Shell Programming and Scripting

How do I Get the Title of My Putty Window (Emulating an XTerm)

I have a Perl script that changes the terminal window title and I would like to reset it to the original value when I am done. We are using Putty which emulates xterm. We are not running X-Windows so I can't use something like xprop (can I?). I'm using XTerm control codes to change the title and I... (2 Replies)
Discussion started by: NateTut
2 Replies

7. UNIX for Advanced & Expert Users

PuTTY TITLE

Is it possible to set the PuTTY title to show the current hostname of the terminal opened? I meant to say I would be rlogin between servers, that should be updated in PuTTTY title ? :confused: (4 Replies)
Discussion started by: ./hari.sh
4 Replies

8. UNIX for Advanced & Expert Users

Change title of aixterm window online

Is there any way to change title of aixterm window online? Also is it possible to freeze first/last few lines online? (1 Reply)
Discussion started by: Soham
1 Replies

9. UNIX for Advanced & Expert Users

putty title window?

I have implemented the solution from mschwage located in post https://www.unix.com/unix-advanced-expert-users/35784-change-putty-title-window.html; ie wt () { echo -n "^2;${@}^G" } This method is awesome!!!! The reason I am sending you this message is to get your assistance with... (3 Replies)
Discussion started by: lwif
3 Replies

10. UNIX for Dummies Questions & Answers

window title..?

how to echo some text onto the window title bar...in exceed client...so that we can know where we are in..in multiple hostnames kinda..thing.. any advice.. (1 Reply)
Discussion started by: tintedwindow
1 Replies
Login or Register to Ask a Question