Seu comando ps
deve funcionar se você classificá-lo corretamente. De man ps
:
--sort spec
Specify sorting order. Sorting syntax is
[+|-]key[,[+|-]key[,...]]. Choose a multi-letter key from the
STANDARD FORMAT SPECIFIERS section. The "+" is optional since
default direction is increasing numerical or lexicographic
order. Identical to k. For example: ps jax --sort=uid,-ppid,
+pid
Não sei ao certo que horas você deseja classificar, mas aqui estão as opções relevantes:
STANDARD FORMAT SPECIFIERS
bsdtime TIME accumulated cpu time, user + system. The display
format is usually "MMM:SS", but can be shifted to
the right if the process used more than 999
minutes of cpu time.
cputime TIME cumulative CPU time, "[DD-]hh:mm:ss" format.
(alias time).
etime ELAPSED elapsed time since the process was started, in
the form [[DD-]hh:]mm:ss.
etimes ELAPSED elapsed time since the process was started, in
seconds.
Eu acho que da sua pergunta que você quer cputime
. Em caso afirmativo, isso deve fornecer a saída desejada:
ps -eo pid,user,args,etime,time,%cpu --sort cputime | grep -v root