LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2017, 10:38 AM   #1
charan1000
LQ Newbie
 
Registered: Nov 2017
Posts: 12

Rep: Reputation: Disabled
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?
 
Old 11-21-2017, 11:09 AM   #2
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,869

Rep: Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049Reputation: 2049
Quote:
Originally Posted by charan1000 View Post
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.
 
Old 11-21-2017, 01:09 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,547

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
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.
 
Old 11-21-2017, 02:34 PM   #4
charan1000
LQ Newbie
 
Registered: Nov 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
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
 
Old 11-21-2017, 04:18 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 5,425

Rep: Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054Reputation: 2054
I thought rknichols' post pretty clearly answered your question...what of that do you not understand, please?
 
Old 11-21-2017, 05:27 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,547

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by charan1000 View Post
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.
 
Old 11-22-2017, 12:46 AM   #7
giis
Member
 
Registered: Nov 2013
Location: Third Rock from Moon
Distribution: RPM/DEB based and LFS
Posts: 73

Rep: Reputation: Disabled
screencast on atime,ctime and mtime.may be helpful here
 
1 members found this post helpful.
Old 11-22-2017, 03:13 AM   #8
charan1000
LQ Newbie
 
Registered: Nov 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
thank you all. especially to giis.

i got clear idea about c-time and m-time
 
Old 11-22-2017, 09:40 AM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,148
Blog Entries: 4

Rep: Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] The system time switches the time zone automatically but doesn't change the time RandomTroll Linux - Software 9 03-15-2013 12:28 PM
Modify script to do mass (file) translation instead of 1 file at a time. k3lt01 Programming 18 10-31-2012 01:36 PM
how to understand user time, sys time, wait time, idle time of CPU guixingyi Linux - Server 1 08-24-2010 10:10 AM
Need to modify chmod & mv to make use of a time-based access control policy avaleriu Programming 3 11-03-2006 09:26 AM
Various clock issues: Clock shows wrong time only in Knoppmyth, & CMOS time change ? davidbix General 1 04-05-2006 09:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration