Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I customized my prompt in .bash_profile to look like this:

export PS1="\w \e[0;32m\$(vcprompt -f '[%n:%b]')\e[m\$ "

Now, when I press up arrow to go back through history, find the one I want, then press control-a to go to the beginning of the line, it often stops me at the 5th character instead of going all the way to the beginning. Those first few characters are then "frozen" in place. If I arrow up or down from there it's as if those characters are the new $.

I press return and am back to normal, but it's quite irritating to have those characters stuck there! Did I screw something up in the customization? Thank you!

share|improve this question
up vote 8 down vote accepted

You need to mark the nonprinting sections of the prompt with \[ ... \] so bash can tell they won't take up space on screen. Try:

export PS1="\w \[\e[0;32m\]\$(vcprompt -f '[%n:%b]')\[\e[m\]\$ "
share|improve this answer
That's the stuff! Thanks, Gordon. – Jed Sep 20 '11 at 0:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.