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.

TOP

Is there any command that by using I can clean the cache in RHEL?

I used this command:

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

but it didn't work.

share|improve this question
    
define didn't work –  warl0ck Dec 15 '12 at 14:30
    
Means command executed successfully but results didnt changed. Means the Cache Memory remained occupied. –  OmiPenguin Dec 15 '12 at 14:34
5  
What's wrong with having something cached? It could speed up access to the cached data. –  ott-- Dec 15 '12 at 14:43
2  
What problem are you trying to solve? –  jippie Dec 15 '12 at 14:59

3 Answers 3

up vote 5 down vote accepted

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

share|improve this answer

This is how you can clear the cache in RH versions 5 onward:

sync; echo 1 > /proc/sys/vm/drop_caches
share|improve this answer

Depending on what you want to do you can use 1,2 or 3

from https://www.kernel.org/doc/Documentation/sysctl/vm.txt

drop_caches

Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.

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

As this is a non-destructive operation and dirty objects are not freeable, the user should run 'sync' first.

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.