Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
Your crontab should almost certainly be using mtime instead of ctime, or a combination of the two. – psusi Nov 15 '11 at 14:14

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… . Is it possible to mark duplicate questions across stackexchange sites? – Adam Monsen Jun 15 '12 at 0:09

Your Answer


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.