Hi Cheng,
Try this
ps aux --sort=-time| head -n 9
_________________
Best Regards,
*Sanjay *
On Sat, 18 Jan 2020 at 21:20, Ls Cheng <exriscer@xxxxxxxxx> wrote:
My workaround so far is this one
ps aux | sort -nrk 10 |head -n 8
ora11tg 134974 99.4 0.0 148788 20248 ? Rsl 2019 193192:27
dg4db2AS400C (LOCAL=NO)
ora11tg 239391 99.3 0.0 148788 20260 ? Rsl 2019 192414:46
dg4db2AS400C (LOCAL=NO)
ora11tg 373433 99.4 0.0 148788 20404 ? Rsl 2019 169730:25
dg4db2AS400L (LOCAL=NO)
ora11tg 351287 99.3 0.0 148788 20556 ? Rsl 2019 123978:02
dg4db2AS400C (LOCAL=NO)
ora11tg 350459 99.3 0.0 148788 20580 ? Rsl 2019 118166:31
dg4db2AS400C (LOCAL=NO)
ora11tg 246739 99.3 0.0 148788 20372 ? Rsl 2019 91998:53
dg4db2AS400C (LOCAL=NO)
ora11tg 48248 99.3 0.0 148788 20416 ? Rsl 2019 72496:28
dg4db2AS400C (LOCAL=NO)
ora11tg 57202 99.4 0.0 148788 20328 ? Rsl 2019 40376:38
dg4db2AS400C (LOCAL=NO)
any other alternatives?
On Sat, Jan 18, 2020 at 4:41 PM Ls Cheng <exriscer@xxxxxxxxx> wrote:
Hi all
This is a bit offtopic, but a little help would be great.
I am trying to get process with highest cumulative CPU time but ps aux
--sort -time| head -n 9 does not work as I expected, I was hoping to see
something similar as following (dg4db2AS400C top processes)
ps aux --sort -pcpu | head -n 9
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ora11tg 57202 99.4 0.0 148788 20328 ? Rsl 2019 40364:32
dg4db2AS400XC (LOCAL=NO)
ora11tg 134974 99.4 0.0 148788 20248 ? Rsl 2019 193192:27
dg4db2AS400XC (LOCAL=NO)
ora11tg 373433 99.4 0.0 148788 20404 ? Rsl 2019 169730:25
dg4db2AS400XL (LOCAL=NO)
ora11tg 48248 99.3 0.0 148788 20416 ? Rsl 2019 72485:18
dg4db2AS400XC (LOCAL=NO)
ora11tg 239391 99.3 0.0 148788 20260 ? Rsl 2019 192392:30
dg4db2AS400XC (LOCAL=NO)
ora11tg 246739 99.3 0.0 148788 20372 ? Rsl 2019 91992:38
dg4db2AS400XC (LOCAL=NO)
ora11tg 350459 99.3 0.0 148788 20580 ? Rsl 2019 118145:25
dg4db2AS400XC (LOCAL=NO)
ora11tg 351287 99.3 0.0 148788 20556 ? Rsl 2019 123978:02
dg4db2AS400XC (LOCAL=NO)
but instead I get this
ps aux --sort -time| head -n 9
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.9 0.0 19420 2224 ? Ss 2018 7513:02
/sbin/init
root 2 0.0 0.0 0 0 ? S 2018 0:25
[kthreadd]
root 3 0.1 0.0 0 0 ? S 2018 1012:14
[ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< 2018 0:00
[kworker/0:0H]
root 8 0.4 0.0 0 0 ? S 2018 3275:05
[rcu_sched]
root 9 0.0 0.0 0 0 ? S 2018 0:00 [rcu_bh]
root 10 0.1 0.0 0 0 ? S 2018 956:02
[rcuos/0]
root 11 0.0 0.0 0 0 ? S 2018 0:00
[rcuob/0]
Anyone know how to sort cumulative CPU time with ps ?
TIA