Change putty title name


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Change putty title name
# 1  
Old 04-23-2012
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 serverB...my putty title still shows as serverA.domainname.com....is there anyway to "AUTOMATICALLY" change that to ServerB.domainname.com without going into putty menu and stuff ???

---------- Post updated at 12:15 PM ---------- Previous update was at 12:11 PM ----------

i know i can use something like below to change the title..but how can it be down automatically ?? without change profile and stuff on each server i do ssh to


printf "\033]0;asdf\007"
# 2  
Old 04-23-2012
Put it into your profile files on the relevant servers, possibly into your PS1(prompt) variable. How to do so depends on the shells involved.
# 3  
Old 04-23-2012
Quote:
Originally Posted by Corona688
Put it into your profile files on the relevant servers, possibly into your PS1(prompt) variable. How to do so depends on the shells involved.
Thanks for the info...but i do not want to put in this all the server, we have well over 600+ servers...it would be painfull to do that....anyway to do this inside ServerA and when i ssh to serverB or serverC....it chanages automatically ?
# 4  
Old 04-23-2012
Perhaps something like
Code:
ssh username@host export PS1="whatever" exec /bin/sh

# 5  
Old 04-23-2012
Quote:
Originally Posted by Corona688
Perhaps something like
Code:
ssh username@host export PS1="whatever" exec /bin/sh

Code:
$ ssh oracle@serverB export PS1="whatever" exec /bin/sh
ksh: /bin/sh: is not an identifier
$
$
$ which sh
/usr/bin/sh
$
$
$ ssh oracle@serverB export PS1="whatever" exec /usr/bin/sh
ksh: /usr/bin/sh: is not an identifier
$


Last edited by Scrutinizer; 04-23-2012 at 06:40 PM.. Reason: code tags
# 6  
Old 04-23-2012
You can replace ssh with your own function. So when you type ssh, you set title, execute real ssh, then set the title back. Try this in profile on ServerA:

Code:
ssh() {
        local args=( "$@" )

        #try find out destination
        while [[ $1 = -* ]]; do shift; done

        printf '\033]0;%s\007' "$1"
        command ssh "${args[@]}"
        printf '\033]0;%s\007' "$USER@$HOSTNAME"
}

This User Gave Thanks to neutronscott For This Post:
# 7  
Old 04-23-2012
Quote:
Originally Posted by neutronscott
You can replace ssh with your own function. So when you type ssh, you set title, execute real ssh, then set the title back. Try this in profile on ServerA:

Code:
ssh() {
        local args=( "$@" )

        #try find out destination
        while [[ $1 = -* ]]; do shift; done

        printf '\033]0;%s\007' "$1"
        command ssh "${args[@]}"
        printf '\033]0;%s\007' "$USER@$HOSTNAME"
}

i saved your funtion in a file and executed it that way...but complaints about this error...


Code:
$ ./test.sh
./test.sh: syntax error at line 2 : `(' unexpected
$


Last edited by Scrutinizer; 04-23-2012 at 06:40 PM.. Reason: code tags
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Change title of a thread after it is created

hi, how do we change the title of a thread after it is created? Thanks (5 Replies)
Discussion started by: milhan
5 Replies

2. 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

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. AIX

How to change cronjob title?

Once I type "mail" command, I got to see the mail like below: > 1 daemon Thu Aug 12 17:31 31/938 "Output from cron job " My question is, how to do change the default title "Output from cron job " to be more customized title? Thanks. (4 Replies)
Discussion started by: ngaisteve1
4 Replies

5. 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

6. 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

7. 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

8. UNIX for Advanced & Expert Users

Change putty title window?

Is it possible to change the putty window title from a Unix command line? (12 Replies)
Discussion started by: akbar
12 Replies

9. Solaris

Change Terminal Title

Is it possible to change the title of a Terminal window on Solaris? For example, for a MS Windows command window, one can simply type "title NameofWindow" to change the title for a command window. I was looking for similar functionality for terminal windows. Thanks. (8 Replies)
Discussion started by: here2learn
8 Replies

10. UNIX for Dummies Questions & Answers

Change Console Title

Hello. I am trying to figure out how to change the title of my console window. I don't need it to dynamically change with my current directory. I just want to be able to change the name of it, so when I minimize the window I can see which windows are for what purpose. I've tried using the... (8 Replies)
Discussion started by: medmonson
8 Replies
Login or Register to Ask a Question