I'm trying zsh on Ubuntu 20.04 from Putty. One good feature I like is that zsh automatically show the running command on window title, which is good for forgetful me who forget what is running.

enter image description here

Nonetheless, I would like to append username and hostname to the running command.

As the screenshot shows, what I'm running is htop. Can zsh set title to, say, gqqnbig@tatooine:~ htop, like the title says when I'm not running anything?

enter image description here

I'm also using oh-my-zsh.

Response to Marlon Richert

Yes, I'm using Putty. If I use Bash, as the screenshots show, Putty fails to set the Window title. Please advise.

enter image description here

enter image description here

  • Zsh doesn't set your terminal's title. That's your terminal that does that. Which terminal do you use? (It looks like PuTTY?) Please update your answer. Mar 22, 2021 at 11:26
  • @MarlonRichert See my update.
    – Gqqnbig
    Mar 23, 2021 at 2:59
  • Thanks! Can you also add which operating system you use? And did it come with Zsh pre-installed or did you install it yourself? If the latter, how did you install Zsh? It would help me figure out why the behavior in PuTTY is different between Bash and Zsh. Mar 23, 2021 at 6:19
  • @MarlonRichert I'm on Ubuntu 20.04. I use apt install zsh and oh-my-zsh is installed via ohmyz.sh#install
    – Gqqnbig
    Mar 23, 2021 at 9:12

1 Answer 1


One good feature I like is that zsh automatically show the running command on window title

That's actually Oh-My-Zsh that does that, not Zsh itself.

To get the behavior you want:

  1. From the Oh-My-Zsh file lib/termsupport.zsh, copy the function omz_termsupport_preexec to your .zshrc file
  2. Change the last line (title '$CMD' '%100>...>$LINE%<<') to
          "%100>...>$ZSH_THEME_TERM_TAB_TITLE_IDLE $LINE%<<"
  • 1
    I find I had to change the second argument to ZSH_THEME_TERM_TITLE_IDLE.
    – Gqqnbig
    Mar 23, 2021 at 13:58

You must log in to answer this question.

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