I have a several GB directory that is rarely accessed, but when it is I'd like to be able to read the files in it quickly instead of having to wait. Since the files are rarely accessed they will not be in the file system cache, but I'd like to suggest that Linux preloads them in the file system cache before I go to access them.Some may argue that I will need to wait for it to load them the first time and so I'm not saving any time -- suffice it to say that in my particular use case I can automate this so it is not a matter of saving system time, it is a matter of saving a user's time (as they don't need to wait if the files are cached).I also realize that the file system cache is not a guarantee without using something like tmpfs, it is a suggestion to the OS, and I'm fine with this.So it seems like the obvious method would be to do:tar -cf - /mydirectory > /dev/nullHowever when I do this, the command returns immediately, even for a several GB directory. It appears that bash is seeing that the output is being directed to /dev/null and optimizing the entire command away, so tar is not actually even reading from the directory.What is a simple command to make the OS read all the files in a directory? 
How to load directory into filesystem cache?
tar;cache
It isn't bash doing this optimization, it's GNU tar. It recognizes when its output is /dev/null and doesn't read the contents of the files.Either arrange for the output not to be /dev/null:tar -cf - /mydirectory > /dev/zeroOr use a different tool, such asfind . | cpio -o >/dev/nullfind . -type f -exec cat {} + >/dev/null