Display multiple colors in bash shell promptAdd this line to your .bashrc file
For changing prompt line color, use values from 40 to 47 instead of 42 in "\e[42m"
\d - the date
\@ - the current time
\! - The history number of the command
\# - the command number of this command
\u@\h -Username@hostname (Useful when you use SCP to copy files between workstations)
\w – Current working directory (Full path)
\e[0;0m - Color ends here so that your shell color is not changed after this
\n - End of line; For prompt to be in the next line so that you have more space to type
bash$ - Just a prompt word and space for you to type
Change the prompt color using tputYou can also change color of the PS1 prompt using tput as shown below:
$ export PS1="\[$(tput bold)$(tput setb 4)$(tput setaf 7)\]\u@\h:\w $ \[$(tput sgr0)\]"