Open utterances-bot opened 3 years ago
Clever! I use the "sort | uniq -c | sort -n" idiom often. Number of threads and processes by user: ps -Teo user | sort | uniq -c | sort -n | tail Breaking it out by commands: ps -Teo user,comm | sort | uniq -c | sort -n | tail
Two other idioms: Using wc -l to count things ps -ef | wc -l Adding "tee /tmp/Results.$$" to save the output of commands ps -ef | grep [Nn]ginx | tee /tmp/Results$$. # Use "grep [Nn]ginx" so you don't match the grep!
Using fold to convert words to lines: fold -w1 Textfile | sort | uniq -c | sort -nr | head # create a frequency table for Textfile.
My Favorite One Liners | Muhammad
Commandline one liners that makes your workflow more productive
https://muhammadraza.me/2021/Oneliners/