Linux file timestamps

Linux stores creation, modification and access file timestamp of a file. Here is brief definitions of these three timestamps:

Creation, modification and access file timestamp
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

Ubuntu Linux

$ 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

  1. If we cat a file, its access time will change
  2. Running stat, moving file etc will not change the file access or modification time.
  3. When we rsync files in archive mode, time modification time remains same, but creation time (aka Change time) will change.
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments