File used

hi guys

How can I view all the files used today or last month in a file system?
Thank you all

When you say used, how do you mean? The file information records three timestamps. Access, change & modification. The command stat and various flags can be used to display any or all of these and the manual page describes what each one is for. It might seem odd, but a change and a modification are not the same.

The flags are as follows:-

I think:-

  • the modification refers to what you normally see as the file's timestamp with something like ls -l $filename
  • the access time is the last read or write operation on the content of the file (but this includes backups
  • the change refers to any operation that updates the inode of the file. This can be a chmod, and update of the content (because the modified time changes)

Does that help?

What format do you need the output as? Sometimes the time since the Epoch (1/1/1970 00:00:00) can be useful to do calculations with.

If you just need to find files older / newer than a known time, perhaps you could use touch with a timestamp to create a reference file and then the -newer /tmp/ref_file or ! -newer /tmp/ref_file construction of a find command.

Do either of these approaches help?
Robin