I want to compare the speed of these two commands:  grep pattern1 files* grep pattern2 files* Unfortunately, the first grep reads much of files* into memory buffers, so the second grep runs very quickly, but for the wrong reason. How do I tell Linux (Fedora 11): please stop caching disk reads because I'm testing something. 
How to time grep commands accurately?
hard disk;cache;measure
I don't think you can, easily, tell it temporarily stop caching. But what you can do is tell the system to drop the cache before each run:As root:sync; echo 3 > /proc/sys/vm/drop_caches(This is documented in the kernel docs at Documentation/sysctl/vm.txt, which is handy if like some of us you can't always remember offhand what the values 1, 2, or 3 do.)Or alternately, of course, prime the cache and compare the cached performance. (I think both are useful numbers.)