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.
Try complete path:
/bin/sync ; /bin/echo 3 > /proc/sys/vm/drop_caches
this always works for me on any flavour of linux.
Depending on what you want to do you can use 1,2 or 3
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:
To free dentries and inodes:
To free pagecache, dentries and inodes:
As this is a non-destructive operation and dirty objects are not freeable, the user should run 'sync' first.
This is how you can clear the cache in RH versions 5 onward: