I have noticed that subsequent runs of grep on the same query (and also a different query, but on the same file) are much faster than the first run (the effect is easily noticeable when searching through a big file).This suggests that grep uses some sort of caching of the structures used for search, but I could not find a reference on the Internet.What mechanism enables grep to return results faster in subsequent searches?
Does grep use a cache to speed up the searches?
linux;grep;cache
Not grep as such, but the filesystem itself often caches recently read data, causing later runs to go faster since grep is effectively searching in memory instead of disk.