31 March 2008

My bash prompt

I like a new line in my prompt so that if I'm deep in a path I don't end up with 10 characters left to type in, and pretty colours so that it's easy to spot the prompt when scrolling through lots of output.

Update 26/04/2008, added red for root.

From my ~/.bashrc
# Comment in the above and uncomment this below for a color prompt
if [ $UID = 0 ] ;then
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[00m\]\n\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;32m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[00m\]\n\$ '
fi


The result (more or less):
tim@lap:~/Documents
$ echo "That's better"


Enjoy.

1 comment:

Anonymous said...

Thanks, it is very nice :)