I've vimed a file, and only afterwards realised that I need the atime (last access time) for the file. Is there any way to recover the atime for a file after accessing it inadvertently?

The filesystem is mounted as so:

UUID=XXXX /home           ext4    defaults        0       2

I'm interested in a distro-neutral solution, however barring that I am currently using Ubuntu Server 12.04.

  • 3
    I wouldn't count on it, but you never know. What filesystem & mount options do you have? – Mat Aug 20 '14 at 8:20
  • Doing a cat file will not change the atime at all. You can check it using stat file If you used view file or vi file that would alter Access, Modify and Change attributes – Valentin Bajrami Aug 20 '14 at 9:23
  • @val0x00ff: I added the fstab options to the question. – dotancohen Aug 20 '14 at 9:37
  • @dotancohen The access time cannot be recovered. The system doesn't keep track of file access times. This is for a reason since auditing otherwise would be impossible – Valentin Bajrami Aug 20 '14 at 9:45
  • @val0x00ff: Thanks, val. I figured that was the answer, but I had to hear it from someone with more experience than me. I'll leave the question open if some neckbeard guru ever comes across it with an answer out of Mordor. – dotancohen Aug 20 '14 at 10:28

This is not possible. There is no history of previous atime values kept in memory by the system.

Well, to be completely honest, the previous atime value may exist somewhere on RAM or even on disk, but you wouldn't know where, nor for how long.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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