On Linux, I often use the free command to see the current amount of free and used memory in the system. For example:
$ free
total used free shared buffers cached
Mem: 7264256 1010952 6253304 0 371892 189088
-/+ buffers/cache: 449972 6814284
Swap: 8126456 28 8126428
It does not seem to exist when I enter free
in Mac OS X's Terminal. Is there an alternative?
Best Answer
As @khedron says, you can see this info in Activity Monitor.
If you want it on the command line, here is a Python script that I wrote (or perhaps modified from someone else's, I can't remember, it's quite old now) to show you the Wired, Active, Inactive and Free memory amounts:
As you can see, you can just call
vm_stat
from the command line, though it counts in 4kB pages, hence the script to convert to MB.The script also counts up the "real memory" usage of all running processes for comparison (this won't match any specific value(s) from overall memory stats, because memory is a complex beast).
Here's an example of the output of the script on my system:
(very slightly adjusted to match the tab sizing on StackExchange ;)