Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I know this is weird but out of the blue, today I copied a long command into the terminal and instead of word wrapping as its supposed to, it started overwriting the same line. The command executed just fine, but it became unreadable. Typically when something like this happens, you can just press Enter a few times and it fixes, but not in this case. I restarted terminal and even rebooted and its the same story.

I might think it has something to do with the fact that I edited my /etc/bash.bashrc file to customize the prompt with color, etc. but I did that several days ago and this didn't happen after I edited it. I saved a backup just in case so if anyone thinks it might be that, I've included the output of the diff of the two files:

$ diff /etc/bash.bashrc /etc/bash.bashrc.bak 
< PS1='\e[1;32m\u: \e[m\w\n\e[1;33m\$\e[m '
> PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

Any ideas are helpful, this is a really strange problem.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Try using this PS1:

PS1='\[\e[1;32m\]\u: \[\e[m\]\w\n\[\e[1;33m\]\$\[\e[m\] '

The difference is that the escape sequences (\e..) are wrapped in \[ .. \], which helps Bash keep track of the cursor better.

share|improve this answer
Perfect it worked! Thanks so much! – jryancanty Feb 5 '14 at 17:58
I have been dealing with this for months, THANK YOU – sunshinekitty May 25 '14 at 9:39

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.