LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   is there relation between modify time & change time of file (https://www.linuxquestions.org/questions/linux-newbie-8/is-there-relation-between-modify-time-and-change-time-of-file-4175618080/)

charan1000 11-21-2017 10:38 AM

is there relation between modify time & change time of file
 
whenever i am modifying data in file ,its getting change in modify time as usual.and change time too.

is there any relation between modify & change time?

jsbjsb001 11-21-2017 11:09 AM

Quote:

Originally Posted by charan1000 (Post 5783443)
whenever i am modifying data in file ,its getting change in modify time as usual.and change time too.

is there any relation between modify & change time?

Exactly what do you mean by "change time" ?

Do you mean "Accessed: ..." time?

If so, the "Modified: ..." means when the file was modified in some way.

The "Accessed: ..." means when the file was last opened.

rknichols 11-21-2017 01:09 PM

The change time (ctime, as returned by "ls -lc") records that last time fields in the inode were changed, and that is more inclusive than the modification time (mtime), which just records the time the content of the file itself was changed. The only inode change that does not result in a ctime update is the automatic change to the access time when the file is read. Everything else, including a change to mtime, permissions, link count, SELinux context, etc., does result in a ctime update.

There is a system call (as used by touch) that allows the access and/or modification times to be set to arbitrary values. There is no such provision for modifying ctime. Note that changing the time access or midification times in this manner does result in an ctime update.

charan1000 11-21-2017 02:34 PM

what i mean is , when i am using stat command with file it is showing three times like access ,modify , change.

access time indicates last time read

modify time indicates last data changed or modified for particular file

change time indicates last metadata got changed.

my query is when ever i am modify data, its effecting not only in modify time and change time too

does modify time , change time have any relation?

hope u got my question.

please let me know

thanks in advance

scasey 11-21-2017 04:18 PM

I thought rknichols' post pretty clearly answered your question...what of that do you not understand, please?

rknichols 11-21-2017 05:27 PM

Quote:

Originally Posted by charan1000 (Post 5783551)
modify time indicates last data changed or modified for particular file

change time indicates last metadata got changed.

my query is when ever i am modify data, its effecting not only in modify time and change time too

does modify time , change time have any relation?

In one sense they are not related, since you can change the modification time to any arbitrary value.

But, whenever you change the data in the file, the metadata gets changed too, and thus both the modification time and the change time get set. So in that sense, they are related.

Take your pick.

giis 11-22-2017 12:46 AM

screencast on atime,ctime and mtime.may be helpful here

charan1000 11-22-2017 03:13 AM

thank you all. especially to giis.

i got clear idea about c-time and m-time

sundialsvcs 11-22-2017 09:40 AM

Bear in mind, also, that many of these directory-entry timestamp values are not maintained, because it creates a great deal of disk-write activity for no actual useful purpose. Expect to find a useful indication of when the file was created, but not when it was last modified or opened.


All times are GMT -5. The time now is 04:53 AM.