The free
commands gives the amount of free memory in two forms: completely free memory (the Mem
line) and disposable memory used for caches and buffers (the -/+ buffers/cache
line):
-bash-3.2$ free -m
total used free shared buffers cached
Mem: 16057 15173 884 0 17 2520
-/+ buffers/cache: 12635 3422
Swap: 12287 4937 7350
In this example, there are 884 MB of free memory excluding buffers and cache, and 3422 MB of free memory including buffers and cache.
How can I get the second measurement (free memory, including buffers and cache) in sar
?
Best Answer
The
-r
flag forsar
will give you kbmfree, kbmemused, kbbuffers, and kbcached. It doesn't, unfortunately, total them like the -/+ buffers/cache column like thefree
command, so you will have to pipe it through an awk or perl script to total them. Try this: