Command line statistics

Well, I’m planning to write here more frequently. For now, I’ll be concentrating on sharing small-ish nuggets of information, instead of trying to write an essay-style post.

This post is about fun little statistics I have gleaned by by zsh history file. Note: my history file contains the last 3000 or so commands I had executed.

Lets begin with trying to find out which version control systems I use most frequently:

$ history | grep 'git ' | wc -l
$ history | grep 'hg '  | wc -l
$ history | grep 'svn ' | wc -l

Mercurial seems to be in the lead right now. Hurrah for distributed version control! We use svn for some projects at work, hg for others. No git, because many of the guys are on Windows.

For my own stuff, I end up using either git or hg, depending on my mood. Don’t really have a preference one way or the other.

Videos & stuff:

$ history | grep 'yd '  | uniq | wc -l
$ history | grep 'vlc ' | uniq | wc -l

yd is my alias for the awesome youtube-dl script that allows me to watch the video in question offline (I hate getting interrupted with a ‘loading’ message when watching anything interesting). It is a resume-able command, so I put in a uniq in the filter chain to just count distinct videos.

grep vs. ack:

history | grep 'grep ' | wc -l
history | grep 'ack '  | wc -l

ack is something better than grep (command name is 25% fewer characters to type!), for code-related stuff anyway. I still end up using grep for piping & stuff, but all the commands above can be re-written by just replacing the grep with an ack.

OK, that’s it for today. Any of you want to share something?

Comments (4)