Bug 166514 - Terminal title not updated properly
Terminal title not updated properly
Product: Fedora
Classification: Fedora
Component: zsh (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Christopher Aillon
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2005-08-22 14:44 EDT by Luke Macken
Modified: 2016-09-19 22:36 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-09-20 12:48:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Luke Macken 2005-08-22 14:44:36 EDT
Description of problem:

When ssh'ing into a remote system, zsh will update the terminal title to
'username@host', but when I log out it does not get updated -- which can lead to

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. ssh into a remote system
2. logout
Actual results:

The terminal title will still show 'username@host' for the system that you
previously sshed into.

Expected results:

The title should be updated to show the current username@host.

Additional info:

This issue seems to be resolved by putting the following in my .zshrc ( possibly
suitable for /etc/zshrc ? ):

precmd() {
    print -Pn "\e]0;%n@%m: %~\a"

I'm far from a zsh expert, so there are probably better ways to approach this.
Comment 1 James Antill 2006-09-20 12:48:48 EDT
 This does not happen automatically. You have configured something to set the
terminal title when you ssh in. From the zsh FAQ (/usr/share/doc/zsh-4.2.5/FAQ) 3.6:

3.6: How do I automatically display the directory in my xterm title bar?

  You should use the special function `chpwd', which is called when
  the directory changes.  The following checks that standard output is
  a terminal, then puts the directory in the title bar if the terminal
  is an xterm or some close relative, or a sun-cmd.

  chpwd() {
    [[ -t 1 ]] || return
    case $TERM in
      sun-cmd) print -Pn "\e]l%~\e\\"
      *xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;%~\a"

...which does have the same problem (because you can't call chpwd on logout, as
you can't get the "previous" user/host). Personally I just do "cd ." whenever I
have that problem (which is obviously a workaround).

 If you want it to "just work" the precmd solution is fine, but I wouldn't put
that in the default dot files ... even if the default files started setting the
terminal title (bash does this, so I might add it too).

Note You need to log in before you can comment on or make changes to this bug.