Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My bash prompt, which I'll admit to have stolen from a few places and cobbled together, will sometimes add part of previous commands to its length when scrolling the bash history with up/down arrows.

For example, if my previous commands were:

cd /home/caleb
vim .bashrc

When I was at my prompt and scrolled up twice it might look like:

$ vim .bcd /home/caleb

Where the first five characters are left over from last command.

Does anyone have any idea why this is happening, and how it can be stopped?

My prompt is set with this code (way to long to include here): https://gist.github.com/1679352

share|improve this question
Set PS1 to a value without the whole vcs crap and see what happens. That's my guess. –  Daniel Beck Jan 26 '12 at 0:44
Have you already found the culprit in your prompt? I'm having the same issue. –  acme 19 hours ago
add comment

1 Answer

Somewhere your prompt is fubar. What usually happens is that your shell thinks its outputting non-printable term codes and expecting it to take up space. The best advice I can give you is to systematically add to (or take away from) your prompt until this behavior stops to isolate the code that is causing this issue.

share|improve this answer
add comment

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.