Chris Andrews
asked on
How to refresh cache for searching using grep?
I'm getting old results when I run grep.
It seems to me I remember something along the lines of grep using a cache I think? And that it needs to be refreshed for a fresh search.
Can you tell me how to do that? I'm on a linux/centos machine.
It seems to me I remember something along the lines of grep using a cache I think? And that it needs to be refreshed for a fresh search.
Can you tell me how to do that? I'm on a linux/centos machine.
>I'm getting old results when I run grep.
An example please ;) grep has no cache as said above already.
An example please ;) grep has no cache as said above already.
ASKER
hmm, interesting...
What I was doing was searching for any instances in my wordpress sites for "FuncQueueObject", to check for any problems with this soaksoak.ru problem that's hitting wp sites..
I found one instance of it, replaced that file with a clean one. and ran the grep command again:
[root@jazz ~]# grep -Rl "FuncQueueObject" /home/
I got back this:
/home/mysite/public_html/w p-includes /template- loader.php
[root@jazz ~]#
Even though I had removed the infection from that file. Double checking it, "FuncQueueObject" isn't there... but grep says it is... that's why I was thinking there must be a cache.
What I was doing was searching for any instances in my wordpress sites for "FuncQueueObject", to check for any problems with this soaksoak.ru problem that's hitting wp sites..
I found one instance of it, replaced that file with a clean one. and ran the grep command again:
[root@jazz ~]# grep -Rl "FuncQueueObject" /home/
I got back this:
/home/mysite/public_html/w
[root@jazz ~]#
Even though I had removed the infection from that file. Double checking it, "FuncQueueObject" isn't there... but grep says it is... that's why I was thinking there must be a cache.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yep indeed, you're right - it was back. I had removed it but that didn't last long. I've removed it again and changed the permissions on that file to read only for all users. Hopefully that will do the trick.
Thanks for the help!
Thanks for the help!
There is the usual filesystem cache in Unix/Linux, but you should never get old results after files have been modified, because the dirty cache pages are written to disk rather frequently!
Running "sync" forces writing of dirty pages to disk, so you can run
snyc
and retry.
To drop the whole filesystem cache you can run this (as root):
sync; echo 3 > /proc/sys/vm/drop_caches
This will not flush dirty objects, however.