How to Clear Cache in Linux

2015-09-16

It should be much more safer to sync the data to disk before clear the caches.

sync

1) Clear PageCache only.

echo 1 > /proc/sys/vm/drop_caches

2) Clear dentries and inodes.

echo 2 > /proc/sys/vm/drop_caches

3) Clear PageCache, dentries and inodes.

echo 3 > /proc/sys/vm/drop_caches