How to change "inode change time" of a file?

6,882

There is no general command to do this. However, depending on the filesystem and your administrator privileges, you can do it.

Here is an answer for the case of ext2/3 and possibly ext4.

Share:
6,882

Related videos on Youtube

uemeulo
Author by

uemeulo

newbie

Updated on September 18, 2022

Comments

  • uemeulo
    uemeulo over 1 year

    I tried to use

    touch -d "2011-09-15 16:50" test.txt
    

    but it just modifies the last access time and the last modified time.

    Access: 2011-09-15 16:50:00.000000000 +0700
    Modify: 2011-09-15 16:50:00.000000000 +0700 
    Change: 2011-11-15 16:56:55.620124149 +0700
    

    How to change the last change time?

    I want to do this because my crontab uses filectime($file) to get the last changed time and I need to create a file of two months ago to test something.

    • psusi
      psusi over 12 years
      Your crontab should almost certainly be using mtime instead of ctime, or a combination of the two.
  • Johnny1am
    Johnny1am almost 12 years
    Yep, this is an exact dup of stackoverflow.com/questions/4537291/… . Is it possible to mark duplicate questions across stackexchange sites?