Activity Monitor command-line equivalent

Discussion in 'macOS' started by ccharbo, Nov 12, 2009.

  1. ccharbo macrumors newbie

    Joined:
    Nov 12, 2009
    #1
    Hi,

    Is there a way to gather all the informations that we can find in the Activity Monitor (cpu, memory, open file-descriptors for each process) via the Terminal ??

    In fact, I am looking for a procfs (/proc) equivalent...
     
  2. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    I am aware of one way, the ps command.

    http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/ps.1.html

    Many people post this as:

    Code:
    ps aux
    While it works, it is done so for convenience and may not be there in the future:

    There are quite a few options available for ps. Hopefully this gets you want you want.

    EDIT: I forgot sysctl, http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man8/sysctl.8.html

    One last thing, you can get procfs from Darwin Ports. http://procfs.darwinports.com/
     
  3. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #3
    You might see if top exists on OS X. I don't recall and don't have an OS X system handy.

    For disk io, you can use iostat.
     
  4. nicroma macrumors 6502

    nicroma

    Joined:
    Jun 20, 2009
    Location:
    Midwest, USA
    #4
    Thats what I was going to say.

    Try typing: top
     
  5. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #5
  6. ViViDboarder macrumors 68040

    ViViDboarder

    Joined:
    Jun 25, 2008
    Location:
    USA
    #6
    Yea, I use 'top' all the time. I've found that htop for my Linux PC is really convenient though too. Anyone know if there is a Darwin version?
     
  7. macrem macrumors 65816

    macrem

    Joined:
    Mar 11, 2008
    #7
    MacPorts has it.
     
  8. ccharbo thread starter macrumors newbie

    Joined:
    Nov 12, 2009
    #8
    Thank you guys.

    In fact, I am mainly interested in open file-descriptors for a given process. top does not give that, so neither ps...

    Any trick ?
     
  9. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #9
    I guess I am not sure what you mean by open file-descriptors. But maybe lsof is close to what you want?

    It will tell you process is using a file.

    http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man8/lsof.8.html

    Most people use it like this:

    Code:
    lsof | grep xxxx
    But of course it has quite a few options.
     
  10. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #10
    As it does in basically every other nix-based system :p
     
  11. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #12
    Thanks for your contribution.
     
  12. ccharbo thread starter macrumors newbie

    Joined:
    Nov 12, 2009
    #13
    lsof !!!! This is EXACTLY what I was looking for. That really does the trick !!!! :)

    Thank you very much all for your contributions !!!
    :apple:
     

Share This Page