2010-03-23

Nice bash prompt

The following is what I put in my .bashrc to have a nice bash prompt on terminal applications that support ANSI colors (e.g. PuTTY, Konsole). I use black as my console background color.

For the root user:
export PS1="\n\033[1;33m\]\t \[\033[1;31m\]<\u>\[\033[1;36m\][\w]\[\033[0m\]\n\$? # "
For a normal user:
export PS1="\n\033[1;33m\]\t \[\033[1;32m\]<\u>\[\033[1;36m\][\w]\[\033[0m\]\n\$? $ "
Result example for the root user:
16:51:48 <root>[/usr/bin]
0 #
Result example for a normal user:
16:51:52 <dimon>[/usr/bin]
0 $

Labels: