Wednesday, November 08, 2006

Better Bash prompt

More colorfull and useful bash prompt

Here is what I did to give a little more color and style to my bash prompt following this blog post:

Edit the .bashrc file in your home directory and define your PS1 env variable in the section that looks like this:


# Comment in the above and uncomment this below for a color prompt
PS1='\[\e[32m\][\u@\h]\[\e[0m\]\[\e[37m\][\t]\[\e[0m\]\n\[\e[34m\][\w]\[\e[0m\]> '


Make sure to replace the PS1 value to anything you prefer. For more information on the meaning of the PS1 values check the Bash-Prompt How-To.

To make the change take effect in the current bash session simply source the .bashrc file like:


[~]> source ~/.bashrc

No comments:

Post a Comment