After my entry on Command Line Text To Speech, I realized that my command prompt is looking pretty sad.
I decided to spruce it up a bit and do something about the excessively long “brad-jaspers-powerbook-g5-15″ string.
I wanted something that was shorter but also gave me the time, so I decided on:

To get this effect, I opened ~/.bash_profile and added the line:
export PS1='\u:\@:\w> '
After logging out and back in, you’ll be greeted with your new terminal.
Here’s a whole list of switches to help you customize your prompt:
\a an ASCII bell character (07)
\d the date in “Weekday Month Date” format (e.g., “Tue May 26″)
\e an ASCII escape character (033)
\h the hostname up to the first `.’
\H the hostname
\n newline
\r carriage return
\s the name of the shell, the basename of $0 (the portion following the final slash)
\t the current time in 24_hour HH:MM:SS format
\T the current time in 12_hour HH:MM:SS format
@ the current time in 12_hour am/pm format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patchlevel (e.g., 2.00.0)
\w the current working directory
\W the basename of the current working directory
\! the history number of this command
# the command number of this command
\$ if the effective UID is 0, a #, otherwise a $
\nnn the character corresponding to the octal number “nnn”
\\ a backslash
\[ begin a sequence of non_printing characters
\] end a sequence of non_printing characters
Note: This is only for the bash shell.
Technorati Tags: Customize Prompt

james
a little wishful thinking on that "g5" there, eh? August 1st, 2005 at 11:51 am
Brad
jh
I've noticed that when I do an 'ls' on my own mac it tends to be monochromatic, however, when I'm ssh-d in to a linux machine and 'ls' I tend to get output that colors directories, and executables differently.
Why is this? And is there any way to get my own mac's output to be color coded as well? August 2nd, 2005 at 10:59 am
Brad
Trackback
[...] Prompt On Mac OS X In the comments of Customize Prompt On Mac OS X, jh asks how to color your command prompt: How about the colored bits below the command prompt? [...]
September 12th, 2007 at 5:15 amplus.tw
export PS1='\u:\@:\W> ' October 17th, 2007 at 11:00 am
Trackback
[...] the comments of Customize Prompt On Mac OS X, jh asks how to color your command prompt: How about the colored bits below the command [...]
December 12th, 2007 at 11:28 pmTrackback
[...] and proceeded to spruce up my command line with the knowledge in Maddox’s post and in MacTip’s Customize Prompt on OS X article. The long and short of it is that the colors in my command prompt bother me so I cut them out of [...]
September 21st, 2008 at 12:06 pm