Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 use filectime($file) to get the last changed time, so I need to create a file of two months ago to test something.

Any help will be appreciated.

share|improve this question
1  
Your crontab should almost certainly be using mtime instead of ctime, or a combination of the two. –  psusi Nov 15 '11 at 14:14

1 Answer 1

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|improve this answer
    
Yep, this is an exact dup of stackoverflow.com/questions/4537291/… . Is it possible to mark duplicate questions across stackexchange sites? –  Adam Monsen Jun 15 '12 at 0:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.