Change the date a file was last modified or created in Linux

To change the date or time you can use the touch command as with the following example:

sudo touch -a -m -t 202008010130.00 fileName.txt

The switches are as follows:

-a = accessed date and time

-m = modified date and time

-t = timestamp – use YYYYMMDDhhmm[.ss] time format

To verify they are all the same, use the stat command

stat fileName.txt

Ref: https://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.