Way to view a list of timestamp history of a document/file via terminal/command line

filesstat

This seems like it's simple but for some reason, it's not:
Problem:
I've been writing a paper- not even a script…just an economics paper- over the last 3 months. I'm trying to determine how much time I've spent writing it, how many times I've saved the file and how much the document grew each change. Is there a command/script to view this info? I'm not looking for exact changes, I'm just looking for the general file information. The only thing I can find is the most recent time the file was modified, but I can't find the information for the modifications before the most recent.

Example of expected output:

$ (elusive and mysterious command that is similar to stat -x) <file>

 File: "file"
  Current Size: 1000        FileType: Regular File
  Mode: (0600/-rw-------)         Uid: (  501/user)  Gid: (   20/   group)
Device: 14,2   Inode: number    Links: 1
Access: Wed Mar 14 19:50:00 2012
Modified: Fri Dec 23 01:22:40 2011
--Size: 1000
Modified: Wed Dec 21 11:42:21 2011
--Size: 920
Modified: Wed Dec 21 11:01:12 2011
--Size: 703
Modified: Wed Dec 21 10:11:01 2011
--Size: 100
Modified: Tue Dec 20 11:42:38 2011
--Size: 0
Change: Mon Feb 13 20:44:36 2012

Best Answer

Typically this information is not kept -- and if it is, it's going to depend very much on what system you're using.

We can infer from your desired output that you're using a Unix-like system. Unix keeps three timestamps for each file: mtime, ctime, and atime, which are the time of last modification, the time the inode was most recently modified, and the last access time. No deeper history is kept for any of these.

The program you're using to modify the file might keep such information, but that depends on what you're using.

If you want to keep track of such things, you probably want to use a source control system. A number of them are available: RCS, CVS, Subversion (SVN), Git, Mercurial (Hg), and many others. You'll have to explicitly check in your file(s) after modifying them in order for modifications to be tracked. Such a system will also let you retrieve and compare older versions.

Related Question