Linux – Show Top Five CPU Consuming Processes with `ps`

linuxps

How to show top five CPU consuming processes with ps?

Best Answer

Why use ps when you can do it easily with the top command?

If you must use ps, try this:

ps aux | sort -nrk 3,3 | head -n 5

If you want something that's truly 'top'esq with constant updates, use watch

watch "ps aux | sort -nrk 3,3 | head -n 5"
Related Question