While the Apple Mac OS X graphical user interface is beautiful and very easy to use, having a powerful Unix command line at my disposal gives OS X something extra. Out of the box Terminal (Applications -> Utilities -> Terminal) is ready to go, but I like to customize all parts of my computer, so here is what I’ve done to Terminal.
I use a colored theme to provide high contrast in my Terminal window. This improves readability tremendously. The theme I like currently is called GiovanniStyle. It uses light yellow on a dark blue background. While the author suggests Consolas for the font I am using Anonymous Pro. Consolas comes with Microsoft Office which I don’t have installed. There is a free font called Inconsolas that mimics the Microsoft offering, but I still like the Anonymous appearance better.
The only drawback to GiovanniStyle is view manpages. By default some of the colors used in man’s output is not contrasty enough to be legible. Consequently I added a section to my .bash_profile to compensate. Here are the color designations I’m using for manpages:
And here’s the output:
Speaking of bash, I’ve modified my prompt, to make it standout more and to provide the information about who I’m logged in as and what my current working directory is, in a manner pleasing to me. Here’s the prompt:
And here’s what it looks like:
.bash_profile and .bashrc
I do not pretend to understand (yet) all the ins and outs of what goes in a .bash_profile and what goes in a .bashrc file. With that disclaimer in mind, I know the .bash_profile is the personal initialization file, which is executed for login shells, and the .bashrc file is the individual per-interactive-shell startup file. In my case I tend to have PATH additions and exports in .bash_profile, while keeping aliases and functions in my .bashrc.
This is my current .bash_profile:
And this is my current .bashrc file:
The calendar alias runs the calendar command against a calendar file of my own making. I just copied the calender.all file in
and eliminated the calendars I wasn’t interested in seeing and called the new file calendar.mark.
The dus alias produces a list of directories and files sorted into order from largest to smallest. It recurses through all sub-directories from where it is run, i.e., running it from your home directory could take a while depending on your processor and the number of files on your system. You can add an -h flag to the du command to get a human-readable output, but that breaks the sorting.
Adventure is fun, you should give it a try. Don’t blame me however, if you get eaten by a grue.
Mailsize spits out the current size of your mail directory. I’m up to 5 GB myself.
bk takes you back to the previous directory. It’s the same as cd - only shorter.
The r function and the rm alias are measures designed to protect me from careless use of the remove (rm) command. Be warned that issuing a rm -rf neatly sidesteps these “protections.” Command-line-interfaces are powerful and therefore can be dangerous.