<p>When running performance tests file system cache hit or miss can significantly influence test results. Therefore generally before running such tests used files are evicted from system cache. How to do that on Linux?</p>

<p><strong>Clarification:</strong> If possible, the solution should not require root privileges.</p>

As a superuser you can do the following:
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
This operation will not "lose" any data (caches are written out to disk before their data is dropped), however, to really make sure all cache is cleaned, you should sync first. E.g. all caches should be cleared if you run
```
```
sync; echo 3 > /proc/sys/vm/drop_caches
```
```
As I said, only a superuser (root) may do so.