Table of Contents

Ubuntu - Swap - Clear swap

Check your swap usage

free -m
 
                    total       used       free     shared    buffers     cached
 
Mem:          1024        157        866          0         11         48
 
-/+ buffers/cache:         97        926
 
Swap:          127         95         32

where


To clear the swap

sync && /sbin/sysctl vm.drop_caches=3 && swapoff -a && swapon -a 

where


Check the swap again

free -m
 
                    total       used       free     shared    buffers     cached
 
Mem:          1024        157        866          0         11         48
 
-/+ buffers/cache:         97        926
 
Swap:          127         0         127