How to clear cache in Linux#
1
|
# sync ; echo 1 > /proc/sys/vm/drop_caches
|
- Clear Dentries and inodes(metadata)
1
|
# sync ; echo 2 > /proc/sys/vm/drop_caches
|
- Clear All cache(include PageCache and Dentries and inode)
1
|
# sync ; echo 3 > /proc/sys/vm/drop_caches
|
How to clear swap space in Linux#
1
|
# swapoff -a && swapon -a
|
NOTE: This may make your system unstable when you have low RAM already. The
data in the swapspace will force move to your RAM and may cause a OOM when you
don’t have free space in RAM.