12 October 2007

Sort CPU usage

I don't know if this works in any unix, but for me works in AIX and Linux.
Sorting CPU usage:


# ps -eo pid,user,%cpu,args --sort %cpu


Source: Kairo Araujo

2 comments:

  1. The following is more cross-platform and almost as good:

    ps -eo pcpu,pid,user,args

    The sort option and the use of % are not universal, but you can pipe the output to something else if you really have a lot of processes.

    ReplyDelete
  2. Daemon9.11.09

    Thank you very much!
    This was exactly what I was looking for!

    Except I wanted mine to be reverse sorted and smaller so:

    # ps -eo pid,user,%cpu,args --sort -%cpu | head

    ReplyDelete