Difference between atime, ctime and mtime for a file in Unixatime, ctime and mtime are last access time, last change time and last modified time of a file in Unix file system. Let us look at these file attributes in more detail.
atime: Last access timeatime is last access time of a file. It gets updates while doing operations like opening the file, parsing the file, running operations like grep, find, ls, cat, tail, sort or more on the file.
mtime: Last modification timemtime is the last modification time of the file. It is updated every time the contents of the file are changed.
ctime: Last change timectime is last change time of the file. It gets updated when special attributes of the file like owner, permission, name etc are changed. It is also modified when the contents of the file are changed.
Most of the times ctime and mtime will be the same, unless only the file attributes are updated. In that case only the ctime gets updated.
How to view atime, ctime and mtime with stat command:stat <filename> will give all the details of the file such as size, Inode number, filetype along with details for atime, ctime and mtime.
How to view atime, ctime and mtime with ls command:1.
ls -lu will show the atime.
2.
ls -ls will show ctime.
3.
ls -l will show the mtime
Published on January 17, 2014 04:25