Founding member of the Free Art & Technology Lab, professor behind the Internet Famous Class, and technology lead at Rocketboom. →more...
jamie dubs posted a photo:
jamie dubs posted a photo:
jamie dubs posted a photo:
jamie dubs posted a photo:
tramchase
Tired of your dull bash prompt?

I rock a different bash prompt on each machine I use to help tell them apart. Vary the colors, add a dash of bold… parentheses, braces, brackets? Heck, maybe even a datestamp.
This here is my PS1 collection, for my reference and your inspiration. Also some notes on crafting your own sweet prompts.
What’s your current prompt?
echo $PS1
How to change your prompt (throw it into your .profile or .bashrc for long-lasting fun)
export PS1='lolcatz$ '
The Classic (blue):

export PS1="[\u@\[\e[34;1m\]\H \[\e[0m\]\w]\$ "
The Classic (green):

export PS1="[\u@\[\e[32;1m\]\H \[\e[0m\]\w]\$ "
The Classic (magenta):

export PS1="[\u@\[\e[35;1m\]\H \[\e[0m\]\w]\$ "
My old BeOS prompt:

export PS1="\[\e[34;40m\]B\[\e[31;40m\]e \[\e[0m\]\[\e[37;40m\]\w\[\e[0m\]]\$ "
Minimalist:

export PS1="\h:\w]\$ "
Solaris Remix (bold white):

export PS1="[\[\e[28;1m\]\H \[\e[0m\]\w]\$ "
Ubuntu Remix (green/pink):

export PS1="\e[32;1m\]\u@\[\e[35;1m\]\H \[\e[0m\]\w]\$ "
D-lux

export PS1="\[\033[36m\][\t] \[\033[1;33m\]\u\[\033[0m\]@\h:\[\033[36m\][\w]:\[\033[0m\] "
Prompt in the titlebar (works with rxvt & Terminal.app)

export PS1="\[\e]2;\u@\H \w\a\e[32;1m\]>\[\e[0m\] "
Approval prompt (via Slashdot comment)
(colored smileys depending on your success)

export PS1="\[\e[01;32m\]\u@\h \[\e[01;34m\]\W \`if [ \$? = 0 ]; then echo -e '\e[01;32m:)'; else echo -e '\e[01;31m:('; fi\` \[\e[01;34m\]$\[\e[00m\] "
Send me your pimp prompt and I’ll tack it on what what.
Color escape code general syntax:
\e[XX;YYm] XX = foreground color YY = background color, but really text styling
Foreground colors
30 = black 31 = red 32 = green 33 = yellow 34 = blue 35 = magenta 36 = teal
Background colors are 40, 41, 42, etc.
Text styles:
0 = reset 1 = bold 4 = underline 5 = blink (!) 7 = invert background & foreground
Reset to plain (always put at the end!):
\[\e[0m\]
Available variables:
\u = your username \H = full hostname, e.g. bob.example.com \h = reduced hostname, e.g. bob \w = full working directory, e.g. /home/jamie/bin \W = basename of the working directory, e.g. bin \t = time in 24-hour format \# = command number \$ = root identifier; $ for regular users, # for root \T = time in 12-hour format \l = terminal device, e.g. tty4 \j = number of background/suspended processes