Clear Memory Buffer Cache

There are three options available to flush the cache of Linux memory. Use one of below as per your requirements.

Free pagecache, dentries and inodes in cache memory

echo 3 > /proc/sys/vm/drop_caches

Free dentries and inodes use following command

echo 2 > /proc/sys/vm/drop_caches

Free pagecache only use following command

echo 1 > /proc/sys/vm/drop_caches

Check Memory

watch -n 3 cat /proc/meminfo
watch -n 3 free -h
free -h

source