I am writing a bash script and I am using
ps -e -o %cpu
command.
I would like to have output of sorted %cpu
values (descending). How to do that?
I know that I should use sort command but I don't know how.
ps -e -o %cpu | sort -nr
n
for numeric, r
for reverse. If you also want to remove the header:
ps -e -o %cpu | sed '1d' | sort -nr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With