Skip to content

Instantly share code, notes, and snippets.

@atika
Last active April 9, 2016 14:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atika/7afea75a11f5530369c8 to your computer and use it in GitHub Desktop.
Save atika/7afea75a11f5530369c8 to your computer and use it in GitHub Desktop.
Statistics of shell aliases usage and optional search for a specific command (change to .bash_history for Bash Shell)
alias_stats() {
local search="$1"
list=""; for c in $(alias | grep "$search" | cut -d'=' -f1); do count=$(grep -Ec ";$c" ~/.zsh_history); list="${list}\n${count} ${c}"; done; echo -e $list | sort -n | grep -Ev "^0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment