mraza007 / blog

Currently hosted on vercel
https://blog-vert-iota.now.sh
MIT License
0 stars 0 forks source link

2021/Oneliners/ #3

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

My Favorite One Liners | Muhammad

Commandline one liners that makes your workflow more productive

https://muhammadraza.me/2021/Oneliners/

joslinpr commented 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.