command-line How-To sysadmin

Commands I Use Frequently

Here’s a list of commands I use frequently, where the first number represents the number of times I used that command today:

86 git – the best version control software ever
59 cd – used to change directories on the command-line
54 ls – used to list files in a directory
41 vim – when textmate just isn’t fast enough for moving and manipulating text I use this text editor
24 grep – this is great for searching through code
21 sudo – I use this for stopping and starting servers and anything that requires super user access

I figured this out by using the following:

history | cut -c8-20 | sort > commands.txt

I created the following script in Perl:

#!/usr/bin/env perl

use strict;
use warnings;

my %h_list = ();
my @sorted = ();
my @listed = ();

open(LS, “commands.txt”);
while() {
if ($_ =~ /(\w+)/) {


foreach my $key (keys %h_list)
push @listed, $h_list{$key} . “\t” . $key;

@sorted = sort { $b <=> $a } @listed;
foreach (@sorted)
print $_ . “\n”;

One reply on “Commands I Use Frequently”

This one-liner (instead of my Perl above) comes from @jmdugan :

history | awk ‘{print $2}’ | sort | uniq -c | sort -nr | less

Bravo! and I wish I learned awk.

Leave a Reply

Your email address will not be published.