Although I'm inclined to myself feel that being intrigued by 'awk' in 2018 might not necessarily lead to the best use of one's time... if you in the second version I posted, the one that filters commands starting with "./", replace the "$2!~/^.\//" [edit: which actually should escape the . as well] with "$2!~/^history/" that would work. Or filter both with "$2!~/^(\.\/|history)/". Just keep adding "|foo|bar" inside the parentheses to filter additional commands.
Code: Select all
history | awk '$2!~/^(\.\/|history)/ { if ($2 != "sudo" || $3 == "-s" || $3 == "-i") cmd[$2]++; else cmd[$3]++; n++; } END { for (s in cmd) { printf("%d %d%% %s ",cmd[s],cmd[s]*100/n,s); for (i=0;i<cmd[s]/12;i++) printf("▄"); printf("\n") } }' | sort -nr | head -n10 | column -t | nl