20

I am using bash and GNU screen on centos7. I notice that if I ssh to another server, change the title (via ctrl+a+A), and log out of the server that my new title gets overwritten by USER@HOST:~. How can I stop it from doing this?

I've looked into dynamic titles and determined that's what's at play, but I'm unsure of how to disable that feature...

1

2 Answers 2

13

As documented in the man page, screen looks for a null title-escape-sequence. bash sends this sequence via the PROMPT_COMMAND environment variable (for example, mine defaults to printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}".

To disable this feature for a particular window, I just run unset PROMPT_COMMAND from that window. Of course, one could just add this to their ~/.bashrc or to a specific environment file to make it more persistent.

1
  • 3
    If $PROMPT_COMMAND is empty, check $PS1.
    – choroba
    Commented Oct 22, 2014 at 22:44
0

On the screen mailing list, Steve Ross wrote:

I just realized that, although one approach is to unset the PROMPT_COMMAND variable, another approach is to use the "screen" command of "defdynamictitle off" in my "~/.screenrc" file. With this setting, the content of the PROMPT_COMMAND variable does not have an effect when opening new screen-window. For a previously opened screen-window, the related "screen" command of "dynamictitle off" lets you to turn off dynamic changes to the title of the screen-window.

You must log in to answer this question.

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