How to Clear Memory Cache on Linux? 

Today if you are using Linux hosting for your website and now if you are looking for information on how to  Clear Memory Cache on Linux then here is the complete information on it. When you buy Linux OS for by default it will have an efficient memory management system which is used to clear the buffer cache periodically. But if you want to clear the cache manually then follow the below command.

top VPS hosting providers    windows VPS server hosting India

Here are the commands to clear the cache in Linux OS:

>>> Use the below command to clear the cache

sk@sk:~$ sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

>>> But if you want to force your Linux OS to clear is cache memory on a particular interval then you need to use the cron job, so in that case you need to open your terminal and  enter the following command to create a file called cacheclear.

sk@sk:~$ sudo vi /home/

>>> So once after adding the above command now you need to add the following lines to file


sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

>>> Now you need to save and exit the file. And next, you need to add the below file to your crontab

sk@sk:~$ sudo crontab -e

>>> Now the command will opens the current use cron file and in there if you want to set it to some other user then follow the below command

sk@sk:~$ sudo crontab -e -u username

>>> Now add the below command line at the end

0 * * * * /home/

linux VPS server hosting India

Once everything is done you need to save and exit the file and the cron job will run this command every hour and it will clear the system memory caches.

Below is the sample results of before running the memory cache clearing script.

Here is the result of after running the memory cache clearing script.