2

This question already has an answer here:

I have 2 laptops, A and B, same OS (ubuntu 18.04). My gnome terminal tab titles on A always show current path in the tab, whereas B show it the one I tell it via the tt and ntt commands I discuss in another question of mine. I have tried

echo -ne "\033]0;MY TITLE\007"'

and

PROMPT_COMMAND='echo -ne "\033]0;MY TITLE\007"'

and

gnome-terminal --title="MY TITLE HERE"

but nothing works, it keeps showing the current folder in tab title. Whereas on laptop B, the same commands work! This is a slightliy different question from How to change Gnome-Terminal title?, because none of the 3 techniques above work.

I remember fiddling around with this a few weeks ago, I must have put something in place that dynamically updates the title every time there is a new prompt, so when I try the echo -ne, it immediately gets overwritten. The env commands shows that there is no PS1 or PROMPT_COMMAND already in place.

Any ideas how to fix this so that echo -ne works again? Is there like a settings file for gnome terminal, it loads every time it starts?

marked as duplicate by wjandrea, karel, Eric Carvalho, Charles Green, Fabby Mar 3 at 6:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Thanks @wjandrea you were right on with your first comment, and darn close with your second one. So it may be useful to others to know that other than the 3 techniques mentioned in my question, there may be a PS1 sneakily set in your .bashrc. Indeed:

  1. An env|grep PS1 will never show PS1; instead use echo $PS1 or declare -p PS1 similarly for PROMPT_COMMAND.
  2. Once I used correct query, I found that PS1 was set with an esc sequence 0, which sets title on tab.
  3. Then I looked in my .bashrc and sure enough the bit of code discussed in Ward's answer was there; the block

    case "$TERM" in 
      xterm*...
    

    prepends the magical arcane esc 0 sequence that sets title, thus preventing any of the other techniques from working!

  4. Uncommenting it allowed me to use the tt and ntt commands I mention in my older question.

Not the answer you're looking for? Browse other questions tagged or ask your own question.