From e0c0d4b38cde20e2300e86b69414dd9851b47456 Mon Sep 17 00:00:00 2001 From: neodarz Date: Thu, 5 Sep 2019 07:05:07 +0200 Subject: ooo --- dotfiles/cheat/history | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 dotfiles/cheat/history (limited to 'dotfiles/cheat/history') diff --git a/dotfiles/cheat/history b/dotfiles/cheat/history new file mode 100644 index 0000000..24e49e4 --- /dev/null +++ b/dotfiles/cheat/history @@ -0,0 +1,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 -- cgit v1.2.1