The role of the Touch command is to create a new blank file and access (access) and modify (modify) timestamp for the file that is updated
View Help for Touch
Note: Modify changes to the contents of the file, regardless of whether access or modify changes, will result in changes in change time, because no matter which operation will cause the file's properties (change times) changes.
Mans Touch
How to use man:
Touch [OPTION] ... FILE ...
Options
-A change only the access time for the file to be modified
-C do not create a file, only modify the file timestamp
-D Modify the timestamp to the specified time
-M Modify File modification time
-R Modify access and modify (modify) timestamps as a reference to a file
-T STAMP modify the timestamp to the specified time
use [[CC]YY]MMDDHHMM[.SS] instead of the current time
Example
Touch update already has file time
First, use the Stat command to view the timestamp of the file
[Email protected]~]# stat test.txt
File: ' Test.txt '
size:0 blocks:0 IO block:4096 Regular empty file
device:803h/2051d inode:1399408 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2017-03-31 16:57:32.000000000 +0800
modify:2017-03-31 16:57:32.000000000 +0800
change:2017-03-31 16:57:32.000000000 +0800
[Email protected] oldboy]# touch-a test.txt
[Email protected] oldboy]# stat test.txt
File: ' Test.txt '
size:0 blocks:0 IO block:4096 Regular empty file
device:803h/2051d inode:1399408 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2017-03-31 17:00:14.000000000 +0800
modify:2017-03-31 16:57:32.000000000 +0800
change:2017-03-31 17:00:14.000000000 +0800
This article from the "Network connected to the World" blog, please be sure to keep this source http://3157957.blog.51cto.com/3147957/1912153
Linux Touch Command