0

How can I change the last edited date of a file? There doesn't seem to be anything like:

chlastediteddate  12/7/12 file

What command can do this? Is there a way to do this without changing what the computer thinks is the date, editing the file, and correcting what the computer thinks is the date?

4

The command you are looking for is touch with the option -d (or --date)

touch - change file timestamp

(...)

-d, --date=STRING

parse STRING and use it instead of current time

For example:

touch -d '2016-01-15 22:41:18' file

or even

touch -d '3 months ago' file

As always man touch is your friend.

| improve this answer | |

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