Re:Show HN: Unix tool that visualizes shell commands usage
by atleta on Friday February 26, 2021 @07:29PM
(#26281476)
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.
Re:Show HN: Unix tool that visualizes shell commands usage
by ReaLNero on Saturday February 27, 2021 @02:05AM
(#26283269)
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.
`history | awk '{print $4}' | sort | uniq -c | sort`
Also, I'm noticing this won't catch anything in pipes otherwise I'd expect to see less and xargs pretty high up.