Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

  • How can i clear all cache and buffered files in linux server (RHEL 5) ?
share|improve this question

marked as duplicate by Michael Hampton Sep 26 '13 at 3:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

@Kumar - you might find the following thread on cache useful: –  Patrick R Jan 30 '10 at 13:39
Someone may be able to suggest something else if you explained why you want to. vm/drop_caches wipes the OS's caches of files on disc; it has no semantic effect just kills performance, which makes it useful for performance testing and (mostly) nothing else. –  MarkR Jan 31 '10 at 21:34

3 Answers 3

up vote 3 down vote accepted

in this post it is explained how to do it:

but be sure to read the complete post for why or why not to clear the caches.

share|improve this answer

As root: echo 3 > /proc/sys/vm/drop_caches

share|improve this answer
sync && /sbin/sysctl -w vm.drop_caches=3 –  A-B-B Jan 21 '14 at 23:43

I had the same concerns about a heavy-handed cache on an embedded box running 2.6.15 (which does not have the proc file mentioned above). I did some experiments and found that one way to force the cache to clear is to create a ramdisk, fill it up with a huge temp file, and then delete the file. Works perfectly. Of course, what I proved was that Linux will indeed release the cache when absolutely ncessary. BTW changing swappiness to 0 or 100 had absolutely no observable effect on meminfo whatsoever.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.