Use this area to offer a short teaser of your email's content. Text here will show in the preview area of some email clients.
Newsletter #1 - July 11, 2013

A little bit about myself first...

Hi, My name is Chip Castle and I'm a long time UNIX hacker.  

For me, it all started in the early 1990's when I was an undergrad student at the University of West Florida and I received my first email account.  I had no idea what email was, nor had I ever written even a single line of code.  I asked one of the beards in the lab how to use the account that had been setup for me and he responded with a condescending "RTFM", to which I hesitantly asked, "What does that mean?".  He then pointed to the tall bookshelves that were jammed with UNIX manuals.  I shuddered to think that I would have to sift through all of that information to do a simple task.  At that time there was nobody available to hold my hand as I entered the UNIX abyss.  

Over the last two decades I have met many software developers and systems administrators who shared some of my struggles, so I thought it would be good to start sharing what I've learned over the years.  
Along that same vein, in the near future I'll be producing a screencast titled, Learning the UNIX command line on OS X, so please stay tuned for a launch date in a future installment.  

In the meantime, I'd like to take this opportunity to share a cool UNIX command line tip with you.  I plan on sharing many more tips like this in the future, so hopefully you'll find them useful.  The tip below received an overwhelming response when I posted it to Coderwall a couple of weeks ago, so I felt it was a great tip to start off this newsletter.

Top 10 shell commands you currently use

First off, I need to credit Ben Orenstein for this idea. Since I’ve found it to be very useful, I thought others could benefit from it, so here goes…

From time to time, I like to analyze which unix or linux shell commands I’m using most frequently. To do this, all I need is a little awk, like the following:

history | \
awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | \
sort -rn | \

So what does this do?

Basically, it parses your history looking at the 2nd column, which is the command you typed and increments it each time it is found.

Then it displays a sorted report showing the count of the command and the command, like this example on my iMac:

1705 git
1420 ack
1016 vi
501 ls
490 commit
310 cd
211 cat
202 g
191 rm
181 c

Based on this output of the top 10 most frequently used shell commands, it shows that I’m using git, ack, and vi a TON, so it would be helpful to create aliases for these commands. I generally prefer 1-character aliases if I can get away with it. Here are a few examples:

alias a="ack"
alias g="git"
alias v="vi"
alias l="ls -al"
alias c="git commit -m"

I have found that these aliases alone have sped up my workflow significantly, as well as reduce the wear and tear on my fingers.

This has become so useful that I created an alias for it as well, which I’ll cover in a later tip.  Please try it out and let me know your thoughts.

Do you have a UNIX command line tip you would like to share?  Or maybe you'd just like to say, "Hi".  If so, please feel free to drop me line at this address or send me a tweet.  If I include your tip in a newsletter, you'll get full credit!

Chip Castle
Thoughts from a UNIX hacker
Learning the UNIX Command Line

Email Marketing Powered by Mailchimp