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?
atime and mtime timestamps can be easily changed using touch command, but there is no a standard way to set a different ctime timestamp. As a possible workaround you can set the system time to the ctime you want to impose, then touch the file and then restore the system time.
You can change both access and modification time of a file using the option -a and -m together.
ctime refers to the last time when a file's metadata. For example, if permission settings of a file were modified, ctime will indicate it. To see the changed timestamp, we can use -lc option with the ls command as follows: Syntax: ls -lc [filename]
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With