Ubuntu – Which is the right way to drop caches in Lubuntu

cachelubuntupermissions

I am currently using Lubuntu 18.04

I thought that theese are the 3 right code lines to drop cache:

sync; echo 1 > /proc/sys/vm/drop_caches

sync; echo 2 > /proc/sys/vm/drop_caches

sync; echo 3 > /proc/sys/vm/drop_caches

I've tried three all with and without sudo and the output is permission denied.

 sudo sync; echo 1 > /proc/sys/vm/drop_caches

bash: /proc/sys/vm/drop_caches: Permission denied

I have all windows closed, no applications running but still permission denied…

I am clearly doing something wrong,
Could anyone tell me which is the right way to drop caches in Lubuntu?

Thanks in advance

Best Answer

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...

Related Question