1

From a Linux Mint terminal window, when I ssh into OpenBSD, the terminal window title remains the same as just the terminal username@localhostname:~, whereas logging into Ubuntu the terminal window title will change to username@remotehostname:~.

I have certainly found many solutions to fix this problem, but the solutions seem to be of many different sorts and rarely seem to be addressing the specific shells I am using.

So rather than good ol' "guess-and-check" to figure out which solution is for me, I would prefer to understand why I am having this problem in the first place so I can move to the next step of discovering a solution.

Why doesn't the terminal window title change when using ssh to log into OpenBSD with Linux Mint?

10
  • 1
    Remote shell on Ubuntu probably uses OSC P s ; P t BEL xfree86.org/current/ctlseqs.html somewhere. Commented Dec 9, 2021 at 18:56
  • Show output of echo $PROMPT_COMMAND, let's see. Commented Dec 9, 2021 at 19:00
  • @ArkadiuszDrabczyk It prints a blank line.
    – Paul
    Commented Dec 9, 2021 at 19:02
  • 2
    @jsotola some graphical terminal emulators, running in a GUI, have a title on the top of their window. I think that is what the OP wants to see changing. Apparently, some Ubuntu systems issue a command changing that title, I have never seen this myself.
    – terdon
    Commented Dec 9, 2021 at 19:18
  • 3
    @Paul it seems that your question is somewhat of an XY question ... you are asking why doesn't...? when you actually want to know how to ...?
    – jsotola
    Commented Dec 9, 2021 at 19:26

1 Answer 1

2

After a terminal window is created, its title only changes when some program within the window outputs a certain series of characters. For xterm windows, this series of characters is <ESC>]0;title goes here<BEL>, though it seems other sequences are also supported.

Presumably, the shell on your Ubuntu system is configured to emit this sequence, most likely as an invisible part of the command prompt. If you're using bash, the configuration telling bash to do this would tend to be located in your ~/.bashrc file, which would have been created from an Ubuntu-supplied default when you created your account on the system.

Your shell on your OpenBSD system, on the other hand, apparently came with no such default configuation, and so, when you are logged into the system, there is nothing telling the running terminal to change its title.

2
  • I searched through ~/.bashrc, ~/.profile, and /etc/bash.bashrc, and none have ESC or BEL. In ~/.bashrc I do have # If this is an xterm set the title to user@host:dir \ case "$TERM" in \ xterm*|rxvt*). (Although Mint uses gnome-terminal.)
    – Paul
    Commented Dec 9, 2021 at 23:40
  • @Paul: Yes, it'd be that block in your ~/.bashrc, but with ESC and BEL written as \e and \a.
    – jwodder
    Commented Dec 10, 2021 at 1:02

You must log in to answer this question.

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