My bash prompt

0 minute read (90 words)

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.


Tweet This || Post to LinkedIn || Page Source

Subscribe for updates on software development, contracting, side projects, blog posts and who knows what else. Read the archives for an idea of content.

Mailing list powered by the excellent buttondown.email.