Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using the following commands to flush cache:

# sync; echo 3 > /proc/sys/vm/drop_caches
# sync; echo 2 > /proc/sys/vm/drop_caches
# sync; echo 1 > /proc/sys/vm/drop_caches

When I use one of the above commands, I get the following:

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

My system running CentOS 6.5, I logged in as root via SSH.

Any suggestions?

share|improve this question

1 Answer 1

I'm not sure why are you're running the 3 commands, when the first one is all you need:

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

This will do the following 3 things: free pagecache, dentries and inodes. Using 1 only frees the pagecache while 2 frees the dentries + inodes.

You're probably experiencing some weird timing issue where:

  1. You're doing this operation too quickly
  2. There is nothing to empty since you just previously ran the command
  3. Your previous command hasn't had a chance to complete or be processed

References

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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