Bash prompt, five examples to set your ownFollow @ggarron
This is a compendium of five good bash prompts I've found all over the web in a long time frame, and have been archiving them and using one and other though the time.
I want now to share them with you, you may probably know some of them as they are taken all over the web.
Two lines bash prompt with full path info
This is one of my favorites, I like minimalism, so this one only have the full path info, and then a minimal prompt in the next line, showing your username
Here is how it looks like:
Date and path in one line
This one shows the date and path in one blue line
PS1="\[\033[1;34m\][\$(date +%H:%M)][\u@\h:\w]$\[\033[0;37m\] "
Three line prompt, Path, time and username
This one is the one I use, I have the path and time info in the path, and a short prompt in the third line so long commands does not loose space.
PS1="\[\033[35m\][\w]\[\033[0m\]\n\[\[\033[32m\][\$(date +%H:%M)]\n\[\033[1;36m\]\u\[\033[1;33m\]-> \[\033[0m\]"
And the result is:
[/etc/nginx/conf] [09:29] ggarron->
Date time in one line, two colors
Here we use colors to separate date and time
[Sun May 22][09:43:27]->
Two lines bash prompt, date, time and full path
This is really nice, and it is a mix of the others, you have two lines prompt, one with [date][time][full path] and the other with a simple -> as your prompt with lot of space for your commands.
[Sun May 22][09:47:07][/etc/nginx/conf] ->
Explaining some parts
If you want to customize this a little, here you have some help:
[\033[31m]: This part set the color from where it is, until a new color is set:
\n: Is a carrier return
\d: Is date
\t: Is time
\w: Is full path
Check that you need to escape with "\" most of the characters used.
Make it permanent
If you want some of these permanent, just past the code of the one you like, in your
Let us know your variations, and your favorite bash prompt