Skip to content

Instantly share code, notes, and snippets.

@cgcardona
Created June 12, 2021 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgcardona/81d934f37e6900bc91438d4549e00ad9 to your computer and use it in GitHub Desktop.
Save cgcardona/81d934f37e6900bc91438d4549e00ad9 to your computer and use it in GitHub Desktop.
Get a list of the top 20 commands and how many times they have been run.
zsh_stats () {
fc -l 1 | awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' | grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment