Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

How to Clear Memory Cache on Linux?

Author: Sindhu Priya
by Sindhu Priya
Posted: Oct 21, 2019

Today if you are using Linux cloud 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 that is used to clear the buffer cache periodically. But if you want to clear the cache manually then follow the below command.

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 its 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 cache clear.

sk@sk:~$ sudo vi /home/cacheclear.sh

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

  • bin/sh

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 open 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/cacheclear.sh

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 are the sample results before running the memory cache clearing script.

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

Going with vps server is one of the best options where you will find a lot of advantages and also helps your business to grow. Cloud is the latest form of technology where you can easily rely upon. And today a lot of companies are using cloud hosting services for their business purpose. So what is the cloud server? It is a virtual server that is running in a cloud technology environment. Today cloud hosting can be used for all types of applications, and not only for business security. In cloud server hosting it provides a scalable and flexible network solution and enables great opportunities to bring the new challenges.

But today if you are using a cloud server hosting for your website and if you are looking for information on how to upload the file to object storage with Node.js on a Cloud server, then here is the complete solution for it. Today object storage is a popular and scalable method of storing and serving static assets for audio, images, text, PDFs, and other types of unstructured data. And today in the cloud server it offers object storage in addition to traditional local or blocks storage, where it is used to store dynamic application files and databases.

About the Author

My name is Sindhu Priya and I work as a content manager. I am specialized in writing helpful articles for writers, students and people who want to improve their writing skills. And my hobby is reading, traveling and blogging.

Rate this Article
Author: Sindhu Priya

Sindhu Priya

Member since: Oct 17, 2019
Published articles: 1

Related Articles