How To Clear Memory Cache And Buffer On Linux

How To Clear Memory Cache And Buffer On Linux

Let’s go through the process to clear memory cache and buffer on Linux based operating systems. We will show how to flush memory cache on Linux.

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

 

READ More Relevant Stuff:  Best Tools To Create Your Own Custom Linux OS In 2023

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *