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?

  • Dupe of https://unix.stackexchange.com/questions/2464/timestamp-modification-time-and-created-time-of-a-file/ – muru Oct 27 '22 at 07:29

1 Answers1

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.

jimmij
  • 47,140