Linux Free RAM Cache

June 4, 2020

First of all check how much memory you have left:

$ mehdi@MPourhadi ~/> free -m
               	   		 total     used         free    shared  buffers   cached
 Mem:		    		 5968      5630         337     64      116       1038
 -/+ buffers/cache:  	 4475      1492
 Swap: 				     6139      56       	6083
 

Issue the the command “sync” to flush the file system buffer then change to root user.

For Debian-base users : “sudo bash”

For RPM packages “su or su -”

When you are root user issue the following command and see the diffrence :

root@MPourhadi:~/# echo 3 > /proc/sys/vm/drop_caches

      NOTE :
      echo 1 is for free pagecache
      echo 2 is for free dentries and inodes
      echo 3 is 1+2

root@MPourhadi:~/# free -m
             				total        used        free     shared      buffers       cached
 Mem:  					    5968         4399        1568     60          2             318
 -/+ buffers/cache: 		4078 	     1889
 Swap: 					    6139         56		     6083