To Clear RAM memory Cache in Linux
RAM memory Cache is a type of memory that stores accessed data to speed up the performance of the system and provide a better and faster experience to the user. In all the Linux systems we have three options to clear the cache without interrupting any services or processes.
Example 1. To Clear PageCache only
Syntax:
sudo sh -c 'echo 1 > /proc/sys/vm/drop_caches'
The command # free -h will give us the status of the memory.
drop_caches is used a clean cache without killing any application, you can run the # free -h command to see the difference between used and free memory before and after clearing the cache.
Example 2. To Clear dentries and inodes
Syntax:
sudo sh -c 'echo 2 > /proc/sys/vm/drop_caches'
Example 3. To Clear PageCache, dentries and inodes
Syntax:
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
How to Clear RAM Memory Cache, Buffer and Swap Space on Linux
RAM memory is a very important component of the computer system. it helps store data and code currently used by the operating system. This article will show how to Clear RAM Memory Cache, Buffer, and Swap Space on Linux. In every system, we come across caches that have unwanted files and can harm our system, the same thing happens in the Linux cache; if you want to clear the cache and free some memory, then Linux has many commands to do that.
Contact Us