Which is the right way to drop caches in Lubuntu?
Solution 1:
Finally I found something that works...
sync
sudo sh -c "echo 1 > /proc/sys/vm/drop_caches"
sync
sudo sh -c "echo 2 > /proc/sys/vm/drop_caches"
sync
sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
And if you want to drop thumbnails make this:
rm -v -f ~/.cache/thumbnails/*/*.png ~/.thumbnails/*/*.png
rm -v -f ~/.cache/thumbnails/*/*/*.png ~/.thumbnails/*/*/*.png
Of course you should use:
sudo apt clean
sudo apt autoclean
And that would be all... At least I thought so... but I may be wrong...
Solution 2:
The easiest way is with a script lifted here:
#!/bin/bash
if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
sync; echo 1 > /proc/sys/vm/drop_caches
sync; echo 2 > /proc/sys/vm/drop_caches
sync; echo 3 > /proc/sys/vm/drop_caches
Call the script drop-caches
.
Mark it as executable using chmod a+x drop-caches
Call it using sudo ./drop-caches
If you place the script in /usr/local/bin
you can call it using sudo drop-caches