This question already has an answer here:
I have a system where we are constantly storing files into RAM (under /tmp/), processing them and then deleting them.
Some files we need to keep in RAM and other not.
My problem is that I want to report how much RAM is left that is useable to store files.
When I use "free" I may get a report that says:
free: 10000 (KB)
However when I run
cat /proc/meminfo I get a different/more-meaningful story:
memfree: 10000 (KB) Cached: 100000 (KB) SwapCached: 0 (KB) Active: 59000 (KB) Inactive: 41000 (KB)
Ok, I have approximated/rounded the values for clarity.
From this post: linux-inactive-memory, I can see that "inactive" memory is usable, and therefore - as far as I am concerned - it is free.
So I should be able to report 10000 KB + 41000 KB of free (well, ok not "free" free, but usable) memory.
Is there a command I can use (or some other method) whereby I can report the total "usable" memory?
I believe the total usable, as far as I understand it, is "free" + "inactive".