Tuesday, June 2, 2015

Clean RAM Cache in Linux

2:21 AM Posted by Mehdi Pourhadi No comments
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
now issue the the command "sync" to flush the file system buffer. then change your root user.
For Debian-base users : "sudo bash" and 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


0 comments:

Post a Comment