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.
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[�33[0;33m][h] - [w][�33[0m]n[�33[0;36m]u [�33[0;31m]-> [�33[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.