Following are my favorite PS1 strings which i use frequently in my bashrc file.


PS1="\n\[\033[38;5;10m\]$(printf %*s $COLUMNS | tr ' ' '-')\n\[\033[38;5;207m\]\d\[\]\[\033[38;5;15m\] \[\]\[\033[38;5;51m\]\t\[\]\[\033[38;5;15m\] \[\]\[\033[38;5;11m\]\u\[\]\[\033[38;5;15m\]@\[\]\[\033[38;5;206m\]\H\[\]\[\033[38;5;201m\]: \[\]\[\033[38;5;47m\]\w\[\]\[\033[38;5;15m\]\n\[\]\[\033[38;5;207m\]$\[\]\[\033[38;5;15m\] \[\]"

PS1="\n\[\033[38;5;207m\]\d \T \[\033[38;5;10m\]\u @ \[\033[38;5;51m\]\H : \[\033[38;5;15m\]\w\n\[\033[38;5;207m\]\[\033[38;5;15m\]$ "


This looks like this 🙂

You can customize one for your self in this useful site http://bashrcgenerator.com/

But this is one liner to get all the colors codes int your command prompt and decide your self.

printf "\nForeground %s\nBackground %s\n\n" "\033[38;5;COLOR_CODE" "\033[48;5;COLOR_CODE"; for i in {0..256}; do echo -en "\033[38;5;${i}m${i}m "; done; printf "\n";

Colorize echo in Bash

Bash uses numeric codes to set attributes of the text to be displayed.

Attribute codes:
00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed

Text color codes:
30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white

Background color codes:
40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white