These are two very different kinds of timestamp :
Modify is the timestamp of the last time the file's content
has been modified, often called mtime
.
Change is the timestamp of the last time the file's inode has been changed, like by changing metadata such as permissions, ownership, file name, number of hard links. It's often called ctime
.
Modification time can be change by using the
touch command
with the -m
parameter.
For examples of using touch
, see the post
How can I change the date modified/created of a file?
As regarding the last status change time, see the post
How can I change 'change' date of file?
where the answer by user "Gilles SO - stop being evil" says:
You cannot change the ctime by ordinary means. This is by design: the
ctime is always updated to the current when you change any of the
file's metadata, and there is no way to impose a different ctime. To
change the ctime of a file, you need to do one of the following:
- Set the system time to the ctime you want to impose, then touch the
file, then reset the system time.
- Modify the kernel to add an
interface to change the ctime.
- Access the disk image directly (e.g.
with
debugfs
) and twiddle the bits on the disk (don't do it while
the filesystem is mounted).
The answer by user Coren gave the exact method :
You have the answer on related SO question pointed by jw013, for extX,
on unmounted disk :
# Update ctime
debugfs -w -R 'set_inode_field /tmp/foo ctime 201001010101' /dev/sda1
# Drop vm cache so ctime update is reflected
echo 2 > /proc/sys/vm/drop_caches