Ask Different is a question and answer site for power users of Apple hardware and software. 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

When I use the command line history ( CtrlR , CtrlP )

The command line screws up like this:
enter image description here

The cursor is supposedly located at the end of the line ( just pressed CtrlE )

If I press enter, just source ~/.bash_profile is executed, the rest is just rubbish on the screen.
Although it works as it should, I'd like the terminal to not be visually broken.

edit: This is my PS1: PS1="\033[0;31m[mac] \033[0;37m\w\033[1;36m> \033[1;0m"

share|improve this question
Your PS1 seems fine. Set it as mine and used command line history to bring up source ~/bash_profile as you described and it worked without issues, but I'm bad at reading those escape sequences manually, so there still could be an issue there that just didn't take effect due to other differences in out setups. – SnoringFrog Aug 14 '15 at 14:54

It's most likely an issue with what you've set your PS1 to in your .bashrc or .bash_profile. Specifically, I'd expect it's related to incorrect escape sequences.

Here is a link with more information. It's hard to tell exactly without seeing what your PS1 is set to.

share|improve this answer
Oh that's probably it. I updated the question with my PS1. Although the colors show correctly, the escape sequences may be wrong. – Petruza May 24 '12 at 15:52

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.