For the longest time, I depended on .zshrc on the target machine to set the title in my (xterm|iTerm) window title. This has one drawback– if the target host doesn’t have my .zshrc (or support zsh), no title. And this bit me nastily the other day when I did something in the wrong window.

Enter this new .zshrc function, which works by setting the xterm title sequence:



Combine this with the following code to set your title to user@host before and after each command and you should always know who you are in a window.