aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/cheat/history
blob: 24e49e49e6db3484699592a76673680811dbfcc7 (plain)
1
2
3
4
5
6
7
8
9
10
# To see most used top 10 commands:
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10

# List all command in zsh bash with human readble date
# Aliased to `history` !
IFS=$'\n'; for line in $(cat ~/.zhistory); do echo $(date --rfc-3339=ns -d @$(echo $line | cut -d' ' -f2 | cut -d':' -f1 | grep -e "^[0-9]") | cut -d'.' -f1)" : "$(echo $line | cut -d' ' -f2- | cut -d';' -f2-); done

# Get top command used
# Aliased to `historyt` !
cat .zhistory | cut -d' ' -f2- | cut -d';' -f2- | awk '{CMD[$1]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10