Thursday, December 30, 2010

Add color to shell prompt

$ vi .bash_profile

add this column into it
# add color to shell prompt
export PS1="\e[0;31m[\u@\h \W]\$ \e[m"

Here is the description 
\e = start color scheme
0;31 = choice of color
\u = Display the current username
\h = Display the hostname
\W = Print the current working directory
\e[m = Stop color scheme 

$PS1 is your shell prompt

\H = Display FQDN hostname
\@ = Display current time in 12-hour am/pm format

List of Color code

Color Code
Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33

Replace digit 0 with 1 to get light color version.

No comments:

Post a Comment