PDA

View Full Version : [xubuntu] Show hostname of different servers in shell tabs



patty92
June 28th, 2013, 07:21 AM
Hi all,

I have open several ssh connections to different servers in one terminal under different tabs at the same time. I just want to know what I have to do that the hostname of the different servers I am connected to, apper in the tabs of my terminal. So that I can distinguish better between the different servers.

Regards,

patty92

dentaku65
June 29th, 2013, 02:16 PM
Hi,
as far as I can tell is already managed in this way in xfce4-terminal; you should have on each tabs the connected hostnames displayed, in this form:
user@hostname

steeldriver
June 29th, 2013, 02:30 PM
it works that way in gnome-terminal for me as well, under the regular Ubuntu desktop - patty92, what version/flavor of Ubuntu and what terminal client (gnome-terminal? xterm? terminator?) are you using?

patty92
June 29th, 2013, 02:36 PM
Hi,

thank you for your answer. I guess you are right, normally this should be the case, but as you can see in my screenshot below, there are 2 tabs. The left tab is an normal terminal on my notebook and in the tab is written patty@Lenovo-G770, this is correct so far, but with the right one I am connected to my server and in the tab is also just wirtten patty@Lenovo-G770 instead of patty@fb-websrv-patty. Is there something I can put in the .bashrc maybe?

Regards,

patty

244256

patty92
June 29th, 2013, 02:41 PM
Hi steeldriver,

I am using xubuntu 13.04 as operation system and my terminal client is a xfce4-terminal.

Regards,

patty

steeldriver
June 29th, 2013, 03:13 PM
It should already be in the (default) .bashrc afaik



# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac


Maybe your remote ~/.bashrc is missing that part - or the $TERM environment variable isn't getting set?

patty92
July 1st, 2013, 11:41 AM
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac




This is set in my ~/.bashrc

dentaku65
July 1st, 2013, 06:54 PM
Hi,

thank you for your answer. I guess you are right, normally this should be the case, but as you can see in my screenshot below, there are 2 tabs. The left tab is an normal terminal on my notebook and in the tab is written patty@Lenovo-G770, this is correct so far, but with the right one I am connected to my server and in the tab is also just wirtten patty@Lenovo-G770 instead of patty@fb-websrv-patty. Is there something I can put in the .bashrc maybe?

Regards,

patty

244256

I see on your screen shot that you connecto to:

patty-hainer.no-ip.org
Is ths hostname declared somewhere on remote machine?

patty92
July 5th, 2013, 10:12 AM
No it is not. The hostname of the machine is "fb-websrv-patty" "patty.hainer.no-ip.org" is just the dynDNS for my server. But this issue is not only related to my own server. On my pc at work, which is running xubuntu 13.04 too the same issue appears if I connect to some servers.

patty92
July 5th, 2013, 05:05 PM
This entered in the ~/.bashrc works for me:

function ssh(){
if [ $# -lt 1 ]
then
echo "usage: no shh"
return
fi
ssh_host=`echo $1 | cut -d "@" -f 2`
echo -ne "\033]0;${ssh_host}"; echo -ne "\007"
/usr/bin/ssh ${1+"$@"}
}

So this issue is solved. Thanks for all of you effort!

Regards,

patty