I want to sort ps output by process CPU time ("TIME" column). I've tried:

ps -aux --sort cputime | tail

but it doesn't sort by cpu time.
I'm running with:

ps --version 
procps version 3.2.7

and kernel: 2.6.18

  • This works on Debian 7.8 (wheezy); procps-ng version 3.3.3. Can you share more about the system you're running? What is the output of ps --version? – Jander May 14 '15 at 7:18
  • Added missing info @Jander – Avner Levy May 14 '15 at 7:42

I think that is not cputime but time that u want :)

ps -aux --sort -time

Just post after --sort the exact name of the column that you want.

with tail:

ps -aux --sort +time | tail

+- for selecting order

  • Trying your command resulted with: ERROR: User name does not exist. – Avner Levy May 14 '15 at 11:10
  • it is working for me at Ubunti 15.04. Try aux without the dash – NIZ May 14 '15 at 11:16

This sorts by CPU:

ps aux --sort -pcpu

This is how it's done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.