How do I get the actual used memory including RAM disks?

free -m does not seems to include memory used by RAM disks (tmpfs filesystems). Maybe because it's something in the kernel space?

How do I get the real memory usage (or it's opposite, free memory) including the allocated space of filesystems that reside in RAM like tmpfs?

I currently check for the memory usage by running df -h and adding the "In use" numbers to the -/+ buffers/cache number. Is there a command available that gives me the real memory usage?


Solution 1:

you can install htop via the terminal

sudo apt-get install htop

then run htop in the terminal

disclaimer I guess this does not work on Lucid correctly

enter image description here

Solution 2:

According to a redhat guide:

When you interpret the values reported by memory.stat, note how the various statistics inter-relate:

active_anon + inactive_anon = anonymous memory + file cache for tmpfs + swap cache

Therefore, active_anon + inactive_anon ≠ rss, because rss does not include tmpfs.

active_file + inactive_file = cache - size of tmpfs

According to that, there must be some co-relation to the command output of cat /proc/meminfo

Active:           346284 kB
Inactive:         497060 kB
Active(anon):     146212 kB
Inactive(anon):   197168 kB
Active(file):     200072 kB
Inactive(file):   299892 kB