Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My prompt is such:

PS1="\[\033[32m\]\u@myserver\n\[\033[33m\w$\033[0m\] "

So as output after I ls i see this:


When I should only (I think) see:


The color commands work (beautifully) but this duplicate line thing is driving me nuts. I adapted this command prompt from the one that comes with MySysGit for windows.

Why is this happening?

If I just hit enter at the prompt, it prints correctly, without the duplicate second line. The duplication only happens after ls, cd or maybe some other bash commands.

share|improve this question

migrated from Jul 24 '10 at 1:02

This question came from our site for professional and enthusiast programmers.

Looks like you're missing a \] before the \w but I don't think that's related to the problem you're asking about... – David Z Jul 24 '10 at 1:04
up vote 4 down vote accepted

I don't see the doubling, but you're missing two escaped brackets:

PS1="\[\033[32m\]\u@myserver\n\[\033[33m\]\w$\[\033[0m\] "

You might also see if PROMPT_COMMAND has a value. It may be producing some output. This will tell you what it's set to:


Without knowing what it contains, I can't tell you what to do about it if it is part of the problem. However, you can clear it like this:


That's nothing after the equal sign.

share|improve this answer
After setting my prompt to what you gave me in the first sample the doubling goes away. Weird, and thanks! – Jake Jul 24 '10 at 2:07

You must log in to answer this question.

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