Here it is. Enjoy.
Article Options
Archives by Category
- Design (1)
- Freebies (1)
- OS X Workflow (1)
- Personal (2)
- Productivity (1)
- Thoughts (1)
- Web Development (3)
Archives by Year
Customize Bash
- Published in: OS X Workflow
- with One comment
If you’re anything other than a beginning web developer, chances are that you use a command line. I’m a big Apple fan and I don’t even own a Windows machine anymore. That being said, I spend a lot of time in Terminal using SVN and especially if you develop in Ruby on Rails. In this post, I’d like to share a little trick that I learned on how to make Terminal easier on the eyes. It’s a simple process that has some nice results.
The Results
Take a look at the final result:

Change Your Window Color
This is a pretty simple step, open up Terminal and in the menu bar select “Terminal –> Preferences”. Under the “Settings” tab, select the “Pro” theme. I personally don’t really like the opacity set on the window, so you can change that by going to “Window” under the “Settings” tab and clicking on the Background color.
Edit Your .bashrc File
The next thing that you need to do is to edit your ~/.bashrc file and add the following code:
# --- Customize Bash Prompt ---
PS1="\n\[\033[0;33m\][\h] - [\w]\[\033[0m\]\n\[\033[0;36m\]\u \[\033[0;31m\]-> \[\033[0m\]"
# --- Setup Color Vars ---
export CLICOLOR=1
export TERM=xterm-color
export LSCOLORS=ExFxCxDxBxegedabagacadOpenInGitGui.app/
If you don’t have a ~/.bashrc file, create one and source it from your ~/.bash_profile. From Terminal, execute the following commands:
$ touch ~/.bashrc
$ vi ~/.bash_profile
Now that your ~/bash_profile is open in Vi, add the following lines to it.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
Save and quit out of Vi (press the escape key then hit “:wq”).
Quit and relaunch Terminal and there you have it. A big improvement over the original shell. Basically all we did was add a PS1 variable and some color coding to your prompt. Our new shell looks like this:
[the hostname up to the first '.'] - [the current working directory, with $HOME abbreviated with a tilde]
the username of the current user ->

If you don’t like what I picked out, customize it! If you are curious as to what PS1 is and all of the funky markup, head on over to the links in the next section, Further Reading. I used all of these links when I was playing around with customizing my Terminal. If you have some cool tips to share, post them in the comments for everyone else to see.
Subscribe to the Notebook RSS Feed
One person left a comment
sPooKee on March 3, 2011 at 7:47 am wrote:
Hy, I like your customization, but I get the following error:
Last login: Thu Mar 3 13:42:44 on ttys001
-bash: [: missing `]‘
iMacBook:~ spookee$
I copy&pasted your code…
Thanks for any answers.
sPooK
Share your thoughts