Hacker News new | ask | show | jobs
by caterama 1944 days ago
Pretty cool terminal visualizations, but tbh straight unix tools allow you to do this (might be different than 4th column for you depending on history format):

`history | awk '{print $4}' | sort | uniq -c | sort`

      56 tree
      58 make
      59 youtube-dl
      69 cmake
      71 which
      76 docker
      78 scala
      80 drive
      80 wget
      96 curl
      99 head
     102 echo
     105 pip
     114 scp
     119 ssh
     131 open
     135 conda
     135 kubectl
     141 man
     181 sudo
     298 mkdir
     350 grep
     378 ls
     409 find
     415 mv
     544 cp
     553 python
     568 brew
     601 cat
     674 rm
    1928 vim
    1972 cd
    2845 git

Also, I'm noticing this won't catch anything in pipes otherwise I'd expect to see less and xargs pretty high up.
2 comments

Add -n to the second sort to actually get a numerically (as opposed to lexically) sorted list. Also, here (using bash on linux) awk needs $2 instead of $4.

It doesn't catch the pipes, because you are parsing the command lines as entered, and you filter for a single parameter from each.

Interesting command usage. One tip I'd offer is to use a `trash` command instead of `rm`. Unix doesn't usually offer it, but installing is as simple as `apt install trash-cli`.

You've gotten lucky 674 times by not `rm`-ing the wrong thing.