unixctime

How to modify 'last status change' (ctime) property of a file in Unix?


I know there's a way to modify both 'modification' (mtime) and 'last access' (atime) time properties of a given file in Unix System by using "touch" command. But I'm wondering whether there exists a way to modify "Last status change" (ctime) property, as well?


Solution

  • ctime is the time the file's inode was last changed. mtime is the last time the file's CONTENTS were changed. To modify ctime, you'll have to do something to the inode, such as doing a chmod or chown on the file.

    Changing the file's contents will necessarily also update ctime, as the atime/mtime/ctime values are stored in the inode. Modifying mtime means ctime also gets updated.