Free -m command explain
When you hit a command at Linux Shell free -m you will get an output like this.
You will notice that free memory is showing 29MB, but it’s not. Linux kernel cache the memory for recent used files for faster access. Used memory is just 1288MB and free memory is 3269MB else but it is cached by Linux kernel.
How to clear memory or drop cache in Linux.
Linux memory cache or this is call drop cache in Linux, if you want to free this memory you can follow the steps.
Since Kernel 2.6.16, you can control how cache behaves, there are four possible “positions” for the switch.
0 -> Will give the Kernel full control to the cache memory
1 -> Will free the page cache
2 -> Will free entries and inodes
3 -> Will free entries and inodes as well as page cache
So, just enter those values to the file /proc/sys/vm/drop_caches, with echo, and as root:
#before remove the cache sync first
Clear Linux Buffer Cache
free && sync && echo 3 > /proc/sys/vm/drop_caches && free