This is not possible after the fact. “Normal” filesystems don't keep a log of the past versions of a file. All you can know is the last time the file was modified (that's the file's modification time, which is shown by ls -l
and by most file managers). You can't find past versions or know when they were made unless the editor happened to leave a backup file behind.
The owner of the file can change the modification time, so it is not useful if you have security concerns and don't trust the author. Files have another timestamp, the ctime (inode change time), which cannot be set manually and is updated whenever the file is modified or moved or its metadata (including the modification time) is modified. So the ctime of a file shows that the current version of the file was created at that time at the latest (assuming you trust the system administrator). You can see the ctime with ls -lc
.
If you want to record the activity around a file, you can use the same methods as for recording when a fle is accessed: an inotify watch, LoggedFS, audit rules, etc. All of these methods only record what happens once they've been set up.
If you want to keep track of the state of the file at certain dates, make backups.
If you want to automatically save all successive versions of a file, edit it via a CopyFS filesystem.
If you want to keep track of successive versions of the file in a convenient way, use a revision control system. This is a cooperative mechanism: versions are recorded when the person doing the modification decides to commit a new version.