Permalink
Browse files

added top_ten_commands one liners

  • Loading branch information...
1 parent 127fd1c commit 3e8344ea6528bd1a447e2279cd65b942aebf2e77 @techmaniack committed Jan 9, 2013
Showing with 16 additions and 0 deletions.
  1. +8 −0 bash/top_ten_commands_bash.sh
  2. +8 −0 bash/top_ten_commands_zsh.sh
@@ -0,0 +1,8 @@
+#! /usr/bin/bash
+#Title:One Liner to display 10 most used commands
+#Link:
+#Requirements: bash
+#Tip:
+#Comment: This one-liner will read the ~/.bash_history file and give the top ten most frequently used commands
+
+cat ~/.bash_history | cut -f1 -d " " | awk '{c [$1]++}END{for(j in c)print j,""c[j]""}' | sort -hr -k2 | head | column -t
@@ -0,0 +1,8 @@
+#! /usr/bin/bash
+#Title:One Liner to display 10 most used commands
+#Link:
+#Requirements: zsh
+#Tip:
+#Comment: This one-liner will read the ~/.zsh_history file and give the top ten most frequently used commands
+
+cat ~/.zsh_history | cut -f2 -d ";" | cut -f1 -d " " | awk '{c [$1]++}END{for(j in c)print j,""c[j]""}' | sort -hr -k2 | head | column -t

0 comments on commit 3e8344e

Please sign in to comment.