Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 4
    This IS the correct answer. Thank you Facundo. I was trying to explain to others that you can use sort and pipe it, but ps also comes built in with an option for sorting and now I see you also use it which is great. Commented Apr 7, 2016 at 16:01
  • The 2nd command appears more useful... but the first one just seems to show bash (x2, or head as well) ps... Commented Jul 3, 2017 at 18:19
  • 3
    @Wilf The first one is for highlighting how to sort by cpu consumption without using the command sort, the second one shows how to specify columns without interfering with sorting. When explaining something.. it's always better to be concise and explain one thing at a time. Commented Jul 10, 2017 at 10:29
  • I was asked a question today about why "ps -eo pcpu,pid,comm,pmem | sort -r k1" does not give correct answer since there are some lowest usages on top, but higher ones in the middle. But when I found your answer and try it, I deleted my question since your suggestion worked correctly. Thanks @FacundoVictor. Commented Mar 4, 2022 at 18:01