I am a terminal junkie. When I was a kid, the first thing that I ever learned to do on a computer was program BASIC on a command line. Then I learned DOS (mostly to play smutty games like Leisure Suit Larry). When I discovered Linux, the amount of raw unadulterated power that could be had from the command line blew me away. It made DOS seem primitive and ancient by comparison. One thing that I really grew to love was my customized command line.
I like Macs because they are a pretty face with a UNIX core. Unlike most flavors of Linux, it has the most plain default command prompts (no colored directory listings, inelegant prompt). However, every time I have to reinstall the OS or set up a new machine (or VM) I always forget to copy over “.bash_profile“. So I end up having to reset my command prompt again and again. So I finally decided to write it down for myself and anyone else who comes across this.
For anyone who wants a good tutorial on customizing BASH can go here. (Also be sure to check out the section on color schemes.) Note: If you start playing around with colors, make sure you wrap all
/e[ tags with
/]. These tell the terminal that they are non-printing characters. If you don’t, it will start messing up word-wrapping.
For those who want to just get some quick colors and a simple prompt, open up “~/.bash_profile” and “~/.bashrc” and paste the following in:
export PS1="\[\e[0;32m\]\u@\h:\[\e[m\e[1;34m\]\w\[\e[m\] \$>"
If you want to have more fun, add the following as well. But make sure you have fortune installed (open a terminal and type “fortune”. If a witty aphorism appears, it is installed.)
Your command line prompt should look like this: