Bash Prompting
I pasted my bash prompt some months ago on a KDE channel on IRC. Today I got a nice e-mail, asking for it, since it was lost in a hard disk format.
This made me realize how much I like that prompt and how used to it, I am. So i decided to put it here, to have a backup.
\[\e[32m\][\u@\h]\[\e[0m\]\[\e[37m\][\t]\[\e[0m\]\n\[\e[34m\][\w]\[\e[0m\]>
Obviously thats very bash.
Short explanation:
\[\e[32m\]
This turns on the green pen, everything is now in green ( Numerical code: 32 )
[\u@\h]
The user (\u) and host (\h) with some eyecandy provided by @ and square brackets. This resolves on my laptop to:
[physos@davinci]
\[\e[0m\]
turning off the green pen
\[\e[37m\]
turning on the grey pen
[\t]
printing the current time in square brackets
\n
adding a newline character which does what it says
\[\e[34m\]
turning on the blue pen
[\w]
current working directory
>
and a nice little bracket to sum it up (change that to $ to be more compatible with textbooks about Linux)
When you do not get lost in square brackets and backslashs, you get something like this.

Write a export PS1= in front of it and put it into your ~/.bashrc. Voila, bash glamour.
If you want to experiment with colors, i.e. red for root (31), I have here a list of codes.

This is just a short glimpse into the world of the Bash Prompt. I learned all I know from the excellent Bash Prompt HowTo in the Linux Documentation Project repository of Linux wisdom. You can find floating clocks, bold text and other miracles inside an environment variable named $PS1 there. Thanks to Giles Orr for providing this nice HowTo and the bash authors for allowing to adjust my environment to my needs, not the other way around.
12 July 2006 at 16:07
Ah rocks
12 July 2006 at 20:50
thanks, my bash prompt looks now much nicer
13 July 2006 at 14:23
[...] Just bookmarking Rainer Endres bash prompt for myself, in case it comes in useful at work.. [...]
15 July 2006 at 22:09
bash? what\\’s that? i like zsh & RPROMPT
Try the following in ur .zshrc
15 July 2006 at 22:11
ugh!
i had posted plain text. some kind of formatting spoiled that post.
15 July 2006 at 22:37
Jep, I am running [markdown](http://daringfireball.net/projects/markdown/)
Should be deactivated in the comments though. Have to look whats going on there.
I am not this into zsh, since I have to work on very different systems and many different kinds of Linux and Unix installations. Bash is the common language in that case.
zsh is a very nice Shell for administrators not alternating between UNIXes often.