After booting up my system and logging in (before starting X, I start it manually via startx) I suddenly get the following output after entering a command:

$ cmd
;user@host: cmd;cmd;cmd;

[output of 'cmd']


After starting X and starting up a terminal this stops; after terminating X it happens again on the plain TTY.

I'm currently using zsh with 'oh-my-zsh'. It only occures there, when using bash it does not occur, there's just a semicolon in front of the username.

Anyone a clue what happens here and how to avoid it?

  • Have you tried removing oh-my-zsh? It seems to cause more problems than whatever it is that it is purported to do...
    – jasonwryan
    Commented Sep 3, 2013 at 21:35
  • Yes, I removed it, it does still occur.
    – alexclooze
    Commented Sep 3, 2013 at 21:43

1 Answer 1


Your zsh is configured to set the title bar in xterm or whatever terminal app you use before invoking a command. It does this by printing out an escape sequence that is intercepted by the terminal. Unfortunately, only terminal emulators understand this sequence, when you're on the console you just see junk.

To configure zsh to do (or not do) this, setup the preexec hook appropriately.

For reference, here is an excerpt from my .zshrc:

if [[ $TERM == "xterm" ]]; then
    if [[ -n $SSH_TTY ]]; then
        precmd () { print -Pn "\033]0;$HOST: %~\007" }
        preexec () { print -n "\033]0;$HOST: $1\007" }
        precmd () { print -Pn "\033]0;%~\007" }
        preexec () { print -n "\033]0;$1\007" }

The outside if ensures we only setup the precmd and preexec hooks if we are inside X.

You must log in to answer this question.

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