Colouring in bash for OS-X
This blog post is more than 5 years old, so the content may be out of date.
I like colours. I like things to stand out. Most of all, I like to be very very clear which computer I'm using when I'm typing in commands (init 0; wait-no-that wasn't the production server, was it?!)
So I want my bash-prompt to look something like this:
And production servers are even more apparent:
(OK, you probably shouldn't ever have to manually ssh into production servers...but just in case).
The bash prompt is controlled by the variable PS1. And OS-X reads the file ~/.profile when starting a new bash session. So you simply set PS1 in ~/.profile, and you're away.
echo "PS1='\[\e[1;32;40m\]\h\[\e[0m\]:\W \u\$ '" | cat >> ~/.profile