How to Clear CentOS cache data

BillEssley

Well-known member
Registered
Joined
Feb 19, 2013
Messages
358
Points
28
I used CentOS so long on my current VPS and not change to another OS. I think there are some big cache files were created there and if that happened, I would like to Clear CentOS Cache Data to free up my storage for my VPS. What is the best way to clear CentOS cache data?
 

miken

Member
Registered
Joined
Feb 6, 2015
Messages
61
Points
8
Hey Bill,

Linux systems create and cache datalots in disk and RAM at intervals depending on the usage patterns. This can create an impression of excessive resource usage on server resources after a certain amount of time and time. If we do not illustrate this with examples, we can compare it to providing browser history.

As you may know, crawlers keep a part of the data in their minds that you will visit the same site again and again with Cache's past visits. When you want to call the same site again, it tries to react more quickly. The Centos cache works on the same logic.

Now let's see how we can clean up these past caches.

If your server is a VPS or a dedicated server, you can use Putty or a different client program through SSH. In order to clear the cache memory of the page, we run the commands as below.

Code:
# sync; echo 3 > /proc/sys/vm/drop_caches
# sync; echo 2 > /proc/sys/vm/drop_caches
# sync; echo 1 > /proc/sys/vm/drop_caches
We will clean up the Centos cache with our commands. It will be useful for automatic caching of server performance and cache data at fixed intervals without the need to specify a cron.

The command I share below will create a scheduled task for automatic cleaning of cache data via SSH.

Code:
# crontab -l
0 * * *  * sync; echo 3 > /proc/sys/vm/drop_caches
Once you've completed the steps, you'll be able to provide the correctness.

You can run #free -m command and observe the output values.

Hope it helps~
 

24x7serverman

Well-known member
Hosting Provider
Registered
Joined
Jul 25, 2017
Messages
651
Points
28

qbeststar

Well-known member
Hosting Provider
Registered
Joined
May 6, 2017
Messages
120
Points
18
I used CentOS so long on my current VPS and not change to another OS. I think there are some big cache files were created there and if that happened, I would like to Clear CentOS Cache Data to free up my storage for my VPS. What is the best way to clear CentOS cache data?
Also you can check your log files here /var/log/
 

mobin

Well-known member
Registered
Joined
Jun 22, 2017
Messages
234
Points
28
I did not get what exactly you want to achieve here. As far as I know, CentOS as an OPerating System itself is not creating any such cache files like you mentioned. There may some applications that is creating cache files/logs files and can fill in data. So you need any analyse the disk usage and understand which directory in the file system is using disk space and that will make things easy. Once you know the location which is exactly consuming most of your disk space, understand why its created and what it is using for, I think you can use with 'du -sch /*' command as the first step.
 
Older Threads
Recommended Threads
Replies
18
Views
8,831
Replies
2
Views
2,480
Replies
11
Views
6,084
Replies
5
Views
455

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top