Linux stores creation, modification and access file timestamp of a file. Here is brief definitions of these three timestamps:
|Creation time (aka Change time)||time when inode was created for that file|
|Modification time||time when file content was edited|
|Access time||time when file was accessed (using cat, etc.)|
To display modification time
$ ls --full-time -l file.txt
$ ls -T -l file.txt
Use stat command to display creation, modification and access timestamp
stat works on both Ubuntu Linux and Mac.
$ stat file.txt File: "file.txt" Size: 4 FileType: Regular File Device: ca01h/51713d Inode: 401709 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 1001/ user1) Gid: ( 1001/ user1) Access: Sun Sep 6 20:08:34 2015 Modify: Sun Sep 6 20:00:31 2015 Change: Sun Sep 6 20:00:31 2015
Few points to note
- If we cat a file, its access time will change
- Running stat, moving file etc will not change the file access or modification time.
- When we rsync files in archive mode, time modification time remains same, but creation time (aka Change time) will change.