Skip to content

Instantly share code, notes, and snippets.

@atika
Last active Apr 9, 2016
Embed
What would you like to do?
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