I found:

However, none of the answers there solve my problem and my situation is slightly different from the linked question.

I work in a large infrastructure where I might log into any of hundreds of hosts in a given day. I don't have the authority to manage the default PROMPT_COMMAND on all of these servers.

I've read through the man page section about naming windows (LESS='+/^TITLES' man screen) and I don't see any solution therein to my problem.

How can I cause my windows in screen to KEEP the titles I set (with Ctrl-A A) regardless of the settings on servers I log into from my screen session?

(Example use case: I might have a window titled "db-hosts" where I can log into a random sampling of DB hosts to check them, logging out from any given one when I am done checking it and logging into a different one.)

  • can you edit the .bashrc (or whatever) and check the login's source IP address (e.g. with something like who -m | awk -F'[()]' '{print $2}' - but note that who's output varies considerably between versions/inplementations), and then unset PROMPT_COMMAND if it's you?
    – cas
    Jul 26, 2019 at 1:43
  • @cas not feasible to do on hundreds (actually thousands) of servers, most of which I may never log into more than once. I just want screen to ignore the titles set from the command line, and only take them from my Ctrl-A-A sequences. Although if there is a way within screen to have the effect of a .bashrc on each server when I log into it, that would suffice.
    – Wildcard
    Jul 26, 2019 at 2:19
  • 1
    you could hack the screen source. or get into the habit of pasting your own 'PROMPT_COMMAND='...'` command into each shell when you log in (unset by itself won't do, you have to undo the damage caused by any existing PROMPT_COMMAND setting)
    – cas
    Jul 26, 2019 at 2:46
  • 1
    on second thoughts, that won't work - you'd need to modify the .bashrc on each remote server. i feel your pain, though - i hate having .bashrc login scripts change my title or add garish colours to my prompts. I nuke the defaults in /etc/skel and so on with extreme prejudice on my own machines, and grit my teeth and bear it on machines I can't "fix".
    – cas
    Jul 26, 2019 at 3:02
  • 1
    @cas, I've opened a bug report (feature request): savannah.gnu.org/bugs/index.php?56674
    – Wildcard
    Jul 26, 2019 at 3:19

1 Answer 1


The bug report I posted was answered almost immediately with a comment that this feature was added in a newer version of screen:

Since v.4.5.0 there is

defdynamictitle [on|off]

for global setting and

dynamictitle  [on|off]

for per window settings.

You must log in to answer this question.

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