How to free pagecache, dentries and inodes from memory on linux

In this tutorial we will learn,how to free pagecache, dentries and inodes from memory on linux systems. The linux system is quite capable to manage the memory itself.Sometimes we require to flush the cache from memory in linux system .
On writing the file /proc/sys/vm/drop_caches cause the kernel to drop clean caches, dentries and inodes from memory.

To free pagecache:

echo 1 > /proc/sys/vm/drop_caches


To free dentries & inodes:

echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

In given below screenshot, you can observe different values for buffers and cached after running the command echo 3 > /proc/sys/vm/drop_caches

flush memory linux

Recommended further reading for inode and dentry

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.