You're viewing a comment by Holy Penguin and its responses.

April 16, 2014, 15:16

What about this?:

history | awk '{ count[$($1="")]++ } END { for (i in count) print count[i], i }' | sort -nr | head

There's a problem for instructions that take more than one line due to here documents, multi-linear strings and the like.

Comment Responses

April 16, 2014, 17:07

history | sed 's/ *[^ ]* *//' | awk '{count[$0]++} END { print count[i],i }' | sort -nr | head

Which is more or less the same as your one-liner but with one iteration less over the whole history. It also respects the spacings inside the commands, thing that my previous command does not.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "disk_334": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.