Do Linux store results of find command in buffer? [closed]

I ran below command in a directory which contains about 7 TB data.

find . -type f -cmin +30 | wc -l

It took around 10 min to show the output.

Ten minutes later, I ran the same command again, this time it was quicker. My question is that does linux had stored the result somewhere? Can anyone explain why second time it didn’t took so long?

Answer

The result of the find command isn’t stored. What happened is this:

When Linux reads from your hard drive it caches that information in RAM, as long as there’s some free. The first time you ran the find command it took ten minutes because the system had to read the data directly from disk, which is much slower than reading from cache. The second time it was able to get a lot of what it needed from RAM, so it returned faster.

Attribution
Source : Link , Question Author : Abhishek dot py , Answer Author : Philip Wilson

Leave a Comment