Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Ubuntu 12.04 I did the following

  1. stat a file
  2. cat the same file
  3. stat the file again
  4. cat the file again after 5 min
  5. stat the file

The access time reported at 3. reflects the point at which 2. was run. However, the access time reported at 5. coincides with 2. and not 4. Is this because Linux serves the file out of cache and avoids disk access in the second instance? Also is there a way to retrieve a list of files that are currently resident in disk cache?

share|improve this question
up vote 4 down vote accepted

Caching is transparent. It does not affect a file's metadata. A file's access date shows when the file was read, never mind whether reading the file caused a read from the disk.

By default, Linux does not update file access times. The default mount option sine kernel 2.6.30 is relatime, which sacrifices the usefulness of file access times for a small performance gain. It seems that your filesystem is mounted with the relatime option, so the second read of the file didn't update its atime.

share|improve this answer
thank you, relatime is indeed the culprit based on /proc/mounts. – iruvar Oct 14 '12 at 22:08

Metadata cache is usually different from file cache. You can get a list of cached files with the fincore utility, see: http://code.google.com/p/linux-ftools/ .

share|improve this answer
@wazook, thanks, +1 for the link to fincore. Working on compiling it. As to your point on metadata cache versus file cache, are you suggesting that output from the stat command in the second case represents stale information from the metadata cache? – iruvar Oct 14 '12 at 21:50
True, but irrelevant here. Caching doesn't influence the file's metadata. – Gilles Oct 14 '12 at 22:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.