Whenever I create a new window in gnu screen I usually give it a name which persists between disconnects, but I notice that with oh-my-zsh distribution of zsh the title gets reset when I run a command in the window. Basically it gets reset to (x* ~) where x is the window number.

Not only that when I run a command in remote session in that window the title which was set locally gets changed to the command run in the remote window if the remote shell is zsh. This doesn't happen with bash.

e.g. lets say I create a new window in screen with the title as (2* ~) and then set the title to user@remotehost because I am going to connect to remotehost as user. When I run ssh user@remotehost to connect to remotehost the title reverts to (2* ~). When in remotehost I run htop the title changes to htop which I don't want.

It seems as though zsh is propagating the remote windows command into the local window's title even if it is connected to another session. This seems to happen only under zsh as it never happens with bash. Is there some setting zsh or oh-my-zsh that overrides the previous behaviour? I haven't changed by .screenrc on switch to zsh and here it is.

# got a fancy hardstatus line noted below
hardstatus on
hardstatus alwayslastline
# hardstatus string "%w"

# blagged this hardstatus like from https://bbs.archlinux.org/viewtopic.php?id=55618, not quite sure what it does
# extended from http://unix.stackexchange.com/questions/195209 and , uptime command disabled
# http://www.gnu.org/software/screen/manual/html_node/String-Escapes.html#String-Escapes
hardstatus string '%{= kG}%{C}Screen:%{Rk}Host:%H %1`%{c}%{= kG}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{C} %d-%m %{W}%c %{g}]'
backtick 1 30 30 sh -c 'screen -ls | grep --color=no -o "$PPID[^[:space:]]*" | cut -d '.' -f 2'
# backtick 2 60 60 /usr/bin/uptime
  • This is done through precmd and preexec functions, or through the prompt. Since you're using oh-my-zsh, there may be a setting to disable it, otherwise you'll have to set those functions/variables manually. Jul 6, 2017 at 22:58
  • 1
    The best solution is to disable oh-my-zsh, there is nothing you couldn't set by yourself, and a lot of useless garbage.
    – jimmij
    Jul 17, 2017 at 15:22

1 Answer 1


It can be disabled in .zshrc by uncommenting the line:

# Uncomment the following line to disable auto-setting terminal title. 

It is applied in the functions omz_termsupport_precmd and omz_termsupport_preexec, which are in ~/.oh-my-zsh/lib/termsupport.zsh

You must log in to answer this question.

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