3

We have a standard "basic server" install of CentOS 6.7 for our servers, and Ubuntu 14.04 for our desktops.

From my Ubuntu desktop, when I ssh into a remote server (ie: ssh into a CentOS instance), my terminal tab shows user@hostname:path

However, when I ssh into a remote desktop (ie: ssh into another Ubuntu instance), my terminal tab shows my_user@my_host:path. That is, it shows the local user and local hostname and local path I was in prior to ssh'ing into the remove desktop.

I have overridden PS1 for both Ubuntu and CentOS hosts

I have a local setting for PROMPT_COMMAND, but nothing on any remote CentOS or Ubuntu host.

[local-ubuntu] $ echo $PROMPT_COMMAND
[local-ubuntu] PROMPT_COMMAND=echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"

[remote-ubuntu] $ echo $PROMPT_COMMAND
[remote-ubuntu] 

[remote-centos] $ echo $PROMPT_COMMAND
[remote-centos] 

I am running GNOME Terminal 3.6.2

[local-ubuntu] $ gnome-terminal --version
[local-ubuntu] GNOME Terminal 3.6.2

Even if I unset my local PROMPT_COMMAND, and then ssh into CentOS, I get user@hostname:path displayed in the tab, but nothing when ssh'ing into Ubuntu.

So my conclusion is that there is something which CentOS is doing to display that information in my tab which Ubuntu isn't doing.

Question:

What configuration exists in CentOS but doesn't in Ubuntu, that shows user@hostname:path for remote terminal sessions?

2
  • How exactly did you unset PROMPT_COMMAND Commented Mar 29, 2016 at 13:31
  • I just commented it out of my .bashrc, unset PROMPT_COMMAND and started gnome-terminal. As such, the tab titles now say "Terminal" instead of user@hostname:path. However, with the tab saying Terminal, when I ssh into CentOS, the tab title is updated, but not with Ubuntu Commented Mar 29, 2016 at 13:39

1 Answer 1

3

Redhat (and by extension, Centos) sets PROMPT_COMMAND with titlebar adjusting control sequences by default:

% bash -xic : 2>&1 | egrep 'PROMPT|PS'
++ PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
++ PS1='[\u@\h \W]\$ '
% 

This setting can be found in the /etc/bashrc file on Redhat:

% grep 007 /etc/bashrc
            PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
% rpm -qf /etc/bashrc
setup-2.8.14-20.el6_4.1.noarch
%

Ubuntu likely does not make any such configuration change in the global shell rc file, which is why the terminal title bar is not changed.

1
  • Ah - thank you - I was looking in env which was incorrect! Commented Mar 29, 2016 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .