aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-12-27 18:24:58 +0100
committerneodarz <neodarz@neodarz.net>2017-12-27 18:24:58 +0100
commitff22323357d9fa2d348bcda1a7465e984d931f3a (patch)
tree701ac95bd102e079db5710334c73720a144fc045
parente5bc32956f29497380d923daa3abcac1906ba3f2 (diff)
downloaddotfiles_ascii-ff22323357d9fa2d348bcda1a7465e984d931f3a.tar.xz
dotfiles_ascii-ff22323357d9fa2d348bcda1a7465e984d931f3a.zip
Add history commands
Diffstat (limited to '')
-rw-r--r--cheat/.cheat/history10
-rwxr-xr-xzsh/.zsh/aliases.zsh2
2 files changed, 12 insertions, 0 deletions
diff --git a/cheat/.cheat/history b/cheat/.cheat/history
new file mode 100644
index 0000000..24e49e4
--- /dev/null
+++ b/cheat/.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
diff --git a/zsh/.zsh/aliases.zsh b/zsh/.zsh/aliases.zsh
index c1e4494..64fbe82 100755
--- a/zsh/.zsh/aliases.zsh
+++ b/zsh/.zsh/aliases.zsh
@@ -154,6 +154,8 @@ alias tsad="printf '\033k┐(T_T)┌\033\\'"
alias tshrug="printf '\033k┐(\`-\`)┌\033\\'"
alias tlol="printf '\033k┐(^0^)┌\033\\'"
alias search="~/.scripts/searx.sh"
+alias 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"
+alias 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"
#█▓▒░ update mpd database
#function genplaylist() {