'Display n most frequent used commands Linux [closed]
A command in linux to list the top N most frequent commands used in your zsh.
Solution 1:[1]
In zsh
fc -ln 0 | awk '{print $1}' | sort | uniq -c | sort -nr | head -<X>
fc -ln 0 - show the historyawk - prints only the command without the argumentssort - for using the next pipeuniq -c - count uniques commandssort -rn - sort by number in reversehead -<X> - list the top X
similar to bash
history | awk '{print $2}' | sort | uniq -c | sort -rn| head -<X>
Special thanks to @ericbn
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
