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.

Similar Reads

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....

Clearing Buffer/Cache in Linux:

Buffer memory is used for storing data temporarily which is being transferred between the CPU and the hard drives. similarly as RAM memory Cache, buffer can aslo accumulate over time and make our system slow. to clear buffer memory we can use the command below:...

To Clear Swap Space in Linux:

Swap space is used a part of hard drive that is used as a supplement of RAM memory. You can clear the swap space by running the below command...

Frequently Asked Questions

How to clear buffer cache swap in Linux?...

Contact Us