0

Is it possible to find under #linux files that were not read since defined period of time?

Reason to do that is to save space on my storage by finding files that are probably not necessary in my archive because I was not looking for them since x years.

3
  • I'll be honest: storage is cheap; like, 4 TB is 5$ a year in a high-safety data center. You should not be doing this speculative pruning of data so valuable you want to backup it; you should be doing incremental backups where unchanged files only need space once. Even if you for some reason can only do full backups, I'd rather look for well-compressing, deduplicating archive methods (like mksquashfs) if (and only if) storage amount actually becomes problematic. Jun 21 at 23:10
  • But since you say "for x years", it really sounds as if you're always doing full instead of incremental backups, and that should be quite straightforward to fix! Jun 21 at 23:11
  • There are ways to enable file access time records, if needed. For that $USER must be in the sudo or wheel group (depending on your sudoers file content) to be able to edit mounting options for the volume of interest in the 4th column of /etc/fstab. Also the volume corresponding to the FS must not be explicitly mounted with noatime and mounting the FS instead with strictatime must be an acceptable alternative for your storage. If so mounting your FS volume with strictatime automatically enables atime and atime can used with the find utility per @kodcode's answer.
    – Cbhihe
    Jun 22 at 12:40

1 Answer 1

1

Yes, find with the -atime flag.

man find will help you further.

1
  • 1
    It's worth noting that atime (access time) is a filesystem feature commonly disabled! Jun 21 at 23:01

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.