Colouring in bash for OS-X
This blog post is more than 9 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:
deimos:~ marcus$
And production servers are even more apparent:
web1:~ marcus$
(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
Comments
Sam de Freyssinet (not verified)
September 1, 2011 - 4:14pm
Permalink
Get some git love on your CLI
marcus
September 1, 2011 - 4:20pm
Permalink
@TODO Man, I need to fix my theme :-(
Nice tool tho!
Add new comment