3 ms·
For a bare-bones approach, this shell command would also do the trick. cut -d\ -f1 ~/.bash_history | sort | uniq -c | sort -rn | head (Note: There should be
by JustinSeriously 14y ago
For a bare-bones approach, this shell command would also do the trick.
cut -d\ -f1 ~/.bash_history | sort | uniq -c | sort -rn | head
(Note: There should be two spaces after the -d\ .)
- socmoth 14y ago(disclaimer: this is my link/blog/software) If that doesn't work for you, this might: history 1 | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr What that doesn't give you is the command tree, for example "git commit" vs "git checkout". It just does "git". [edit, added gem link] The gem is here https://github.com/paulmars/huffshell https://github.com/paulmars/huffshell
- psykotic 14y agoGenerating the word tree is short and simple, though. It's also useful as a standalone Unix utility. Here's my one-minute hack: import sys import collections tree = lambda: collections.defaultdict(lambda: [0, tree()]) def printtree(node, indent=0): padding = indent * ' ' for word, (count, child) in node.iteritems(): print "%s%s %d" % (padding, word, count) printtree(child, indent + 2) wordtree = tree() for line in sys.stdin: node = wordtree for word in line.split(): node[word][0] += 1 node = node[word][1] printtree(wordtree)