How to Clear CentOS cache data

Report
Posts
2
Registration date
Friday August 14, 2020
Status
Member
Last seen
August 28, 2021
-
Posts
10905
Registration date
Friday October 30, 2015
Status
Moderator
Last seen
October 25, 2021
-
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?

1 reply

Posts
10905
Registration date
Friday October 30, 2015
Status
Moderator
Last seen
October 25, 2021
1,595
Hi,

You can use the following commands to clear cache. The Linux system will not be interrupted.
  • Clear PageCache only :

# sync; echo 1 > /proc/sys/vm/drop_caches
  • Clear dentries and inodes :

# sync; echo 2 > /proc/sys/vm/drop_caches
  • Clear PageCache, dentries and inodes :

# sync; echo 3 > /proc/sys/vm/drop_caches