Kevin Burke
Kevin Burke

Reputation: 64944

How to get Bash command history statistics, like the most used commands in the last 6 months?

How can I see, for example, what are my most used commands in the last 6 months in bash? Can I store this data somewhere?

Upvotes: 10

Views: 2828

Answers (3)

Teddy
Teddy

Reputation: 6163

You want the lastcomm command. You'll need to install and/or activate the "acct" package - how to do this depends on your operating system.

Upvotes: 1

jasonwryan
jasonwryan

Reputation: 4554

history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rn|head -30

From a thread on the Arch Linux boards

Upvotes: 19

deltaforce2
deltaforce2

Reputation: 593

I'm not sure how far back it will go, but bash's history command will tell you your previous commands. Maybe it can be configured to store up to 6 months of data and then a grep/sed/etc spell can tell you what you want?

Upvotes: 0

Related Questions