Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ccharbo

macrumors newbie
Original poster
Nov 12, 2009
4
0
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...
 
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:

Apple ps man page said:
The biggest change is in the interpretation of the -u option, which now displays processes belonging to
the specified username(s). Thus, "ps -aux" will fail (unless you want to know about user "x"). As a
convenience, however, "ps aux" still works as it did in Tiger.

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/
 
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.
 
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?
 
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 ?
 
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 ?

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.
 
lsof !!!! This is EXACTLY what I was looking for. That really does the trick !!!! :)

Thank you very much all for your contributions !!!
:apple:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.