How to alter only access time, modify time or change time of files or folders in Linux
Read this article to know how to change only the atime, ctime or mtime of a file or directory in Linux in the most simplest of the way.
Access time (atime), Modify time (mtime) and Change time (ctime) are metadata of files and folders in a Linux distributions. These can be checked by using stat command on a file or folder:
stat file1 or stat dir1
Before I tell you how to modify any of these values let me explain in brief what exactly are these.
Now let's see how we can update each one of the individually:Updating atime, mtime or ctime of a file
Updating these for a file is quite easy. If you see the man page of touch command you will see that it has parameters which are specifically there to update only ctime or the mtime.
To update only atime of a file - touch -a file1
To update only mtime of a file - touch -m file1
To update only ctime of a file - chmod 777 file1 [Note: Use just need to change the permissions, the combination can be anything like 544, 111 and so on..]Updating atime, mtime or ctime of a directory
Please note that it is not possible to modify the mtime without modifying the ctime.
To update only atime of a directory - Use cat command on a file inside the directory you want to change the atime for.
To update only ctime of a directory - chmod 777 dir0
To update mtime of a directory - Touch a file or create a subdirectory inside the directory you want to change mtime for.
Read How Fedora Linux is better than Windows OS?

