How To Clear Memory Cache And Buffer On Linux
We have different option to clear memory on Linux.
First option to clear memory caches on Linux.
Command to free pagecache, dentries and inodes in cache memory in Linux.
sync; echo 3 > /proc/sys/vm/drop_caches
Second option to clear memory cache.
Command to free dentries and inodes
sync; echo 2 > /proc/sys/vm/drop_caches
Third option to clear memory cache on Linux.
Run the following command to free pagecache only:
sync; echo 1 > /proc/sys/vm/drop_caches
How To Schedule Cron To Flush Cache Regularly
Run the following command to schedule cron to flush cache regularly. It makes your job easier and reduce the work pressure. Use
‘crontab -e’ command to edit cron on your Linux.
crontab -l 0 * * * * sync; echo 3 > /proc/sys/vm/drop_caches