Guest User

Untitled

a guest
Jun 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # I want to know what I should automate more.
  4. # List the commands I re-type most often.
  5.  
  6. EXISTING_SHORTCUTS='abcefhlgrz'
  7.  
  8. # Annotated:
  9. grep \
  10. --perl-regexp `# Use perl compatible regular expression syntax` \
  11. --invert-match `# Show lines that don't match`\
  12. "^[$EXISTING_SHORTCUTS]( |$)" `# Select lines that don't use an existing shortcut` \
  13. ~/.bash_history \
  14. | sort | uniq --count `# List repeated items by frequency` \
  15. | sort --numeric-sort `# Sort by frequency`
  16.  
  17. # Abbreviated:
  18. # grep -Pv "^[$EXISTING_SHORTCUTS]( |$)" ~/.bash_history | sort | uniq -c | sort -n
Add Comment
Please, Sign In to add comment