Linux - How to clear cache memory on linux, Clean & empty buffers and cache on a Linux system

How to clear cache memory on linux

Before clearing cache memory on a Linux system?
 # free -m
              total       used       free     shared    buffers     cached
 Mem:         15943       8935       7008          0        358       6805
 -/+ buffers/cache:       1771      14172
 Swap:         1023          0       1023

How to Clean & empty cache memory on a Linux system?
 # sync && echo 3 > /proc/sys/vm/drop_caches

After clearing cache memory on a Linux system?
 # free -m
              total       used       free     shared    buffers     cached
 Mem:         15943       1601      14341          0          2         40
 -/+ buffers/cache:       1558      14384
 Swap:         1023          0       1023

To free pagecache:
 # echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
 # echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
 # echo 3 > /proc/sys/vm/drop_caches

To clean SWAP memory, first disable swap
 # swapoff -a

Then enable SWAP memory
 # swapon -a
This will clean and enable swap memory

The topic on Linux - How to clear cache memory on linux is posted by - Guru

Hope you have enjoyed, Linux - How to clear cache memory on linuxThanks for your time

Tech Bluff