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.

Browsing the last command's results in Bash is a bit hard because the command prompt and results are the same color. This makes it hard to separate the results of consecutive commands.

How do I change the color to pink for example?

share|improve this question
You'll want to add color to the PS1 variable. –  Rob May 8 '12 at 17:34
Yes, my current PS1 is PS1='\u:\w\$ ' which I do not know what does mean. How should I change it to colorize command prompt to pink with out loosing current settings? –  Yasser Zamani May 8 '12 at 17:40

1 Answer 1

up vote 5 down vote accepted

@Rob is right; specifically, to change to light red (pink is not an available color):

PS1 = "\[\033[1;31m\]\u:\w\$\[\033[0m\] "
#      ^^^^^^^     ^^                    Begin/end ANSI escape
#             ^^^^^                      "light red foreground"
#                    ^^^^^^^             Your original prompt
#                           ^^^^^^^^^^^  Reset color back to default foreground

You need to use ANSI escape sequences (in this case 1;31m, the code for "light red foreground") which are enclosed by \[\033[ and \].

Edit: Light purple may be closer to your desired color; the PS1 change is left as an exercise for the reader.

reference @ the linux documentation project

share|improve this answer
I'm not great with ansi codes, so I left the answer to someone else. –  Rob May 8 '12 at 21:53
Thanks a lot @alex-hirzel, it worked! –  Yasser Zamani May 9 '12 at 15:08

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.