Clear Ubuntu Filesystem Memory cache

sudo sh -c “sync; echo 3 > /proc/sys/vm/drop_caches”

or


sync; echo 3 > /proc/sys/vm/drop_caches   run in the Root Terminal



this worked for me on 10.04

There are actually two things you can clear, and they’re both read caches. Write caching is a different thing entirely, and is referred to as ‘dirty memory’. 1 is file data (contents), 2 is file metadata(time, date, permissions, names, etc), and 3 is both. So for example, if you do a ‘find /’ looking for a file, and then read a 1GB file, and want to evict the 1 GB of data, but not lose the cached ‘find’ info, you can echo 1.

man /proc and look for drop_caches for the exact details