Activity Monitor has a number of columns that show different measurements of memory usage for each process. Including:

  • Memory
  • Real Memory (various)
  • Compressed Memory

How can I display these for a specific process or app in Terminal, AppleScript or Xcode?

  • 1
    ps avx might be a good start – nohillside Apr 20 '18 at 13:41

The terminal command top -stats is what you need to use. Executing man top will give you all the usage info.

Note: The keys used in the -stat option are listed under the -o option.

Here are some sample top -stats commands you can try to see what you can glean from the output with different keys.

top -stats cpu,mem,pid

top -stats cpu,mem,pid -pid 106

top -stats cpu,mem,pid,command

The last command example outputs this:

%CPU                         MEM                            PID                           COMMAND
3.6                          2308K                          2191                          top
0.0                          3156K                          2190                          mdworker
0.0                          3248K                          2187                          mdworker
0.0                          3132K                          2186                          mdworker
0.0                          3280K                          2185                          mdworker
0.0                          3240K                          2184                          mdworker
0.0                          3156K                          2183                          mdworker
0.0                          3196K                          2182                          mdworker
0.0                          3156K                          2181                          mdworker
0.0                          4704K                          2175                          quicklookd
1.7                          17M                            2067                          backupd
0.0                          7652K                          2046                          mdworker
0.0                          17M                            2045                          mdworker
0.0                          19M                            2044                          mdworker
  • This is closest. What unit of measurement does top use? 1000 or 1024? And how would I find all processes that are children of, say, Terminal or Safari? – Matt Sephton Apr 21 '18 at 9:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .