How to change bash prompt color

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Last Updated: September 30, 2014 | Reading Time: < 1 minute

A friend asked me about how to change bash’s prompt color after you logged in, regarding my previous post.


I utilize a bash PS1 generator, just play around with the options and copy the Result code into the clipboard.


Next step, after you logged in, open with your favorite editor file named .bashrc:
$ vi ~/.bashrc

Paste the Result code from the PS1 Generator:
# Custom bash prompt via
export PS1="\[$(tput setaf 1)\]\[email protected]\h:\[$(tput setaf 7)\]\W\\$ \[$(tput sgr0)\]"

then, execute bash to see the result:
$ exec bash

All done. 🙂

Any idea? Fill the comment below

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More To Explore