An explanation of some of the parts – see the snippet title for a description of what each one does.
Set the text to colour to MAGENTA and show the logged in username:
Show the current working directory, in GREEN:
Show the git branch, if one exists, including enabled options:
`__git_ps1 " on %s"`
Reset to WHITE, carriage-return plus line-feed, run prefix function:
Change font colour to CYAN:
Save the current cursor position:
Move the cursor 60 columns to the right and display today’s date in parentheses:
33[60C (`date "+%a, %b %d"`)
Restore the cursor position and reset colour to WHITE:
How do I use it?
You don’t have to do anything other than have the .bash_profile script in your home directory. BASH will automatically execute it when a BASH shell starts and set everything up for you.
And it looks like this …
Before you say anything, yes, I’m aware I used a slightly different colour for the date. 😉
The complete script is available on the last page of this article.