sorin
sorin

Reputation: 170498

How assure that gnome-terminal is displaying the correct hostname on window title?

I am looking for a solution that would update the window title to the current host.

I am usually doing ssh to different boxes and I observed that the window title in Gnome Terminal (3.0.1 from Ubuntu 11.00) is not correctly updated. Currently it displays "user@localcompure: path" - and I want to be updated after I do a ssh.

I should note that I am looking for a solution that will not require me to change settings on any machine I'm connecting to.

Upvotes: 0

Views: 783

Answers (1)

Tyler Kalevra
Tyler Kalevra

Reputation: 21

I'm looking to do the same here, the functionality works fine in konsole(kde's terminal app) but not from within gnome-terminal. The best solution I have found thus far is to invoke this by using a separate app with the following:

#!/bin/bash
#!/bin/bash
SETTP='MY_PROMPT="$HOSTNAME:$PWD\$ "'
SETTP="$SETTP;"'MY_TITLE="\[\e]0;$HOSTNAME:$PWD\a\]"'
SETTP="$SETTP;"'PS1="$MY_TITLE$MY_PROMPT"'
ssh -t $1@$2 "export PROMPT_COMMAND='eval '\\''$SETTP'\\'; bash --login"

found and copied from: https://unix.stackexchange.com/a/40337?sgp=2

Upvotes: 2

Related Questions