Touch:change file timestamps changing the timestamp
Common options:
-A change the file's access time to the current time
-M change the file's modified content time to the current time
-C Change the CTime time of the file to the current time, that is, modify the file's properties and permissions time
Instance:
[[email protected] ~]# touch a.txt #创建空文件,常用[[email protected] ~]# ls -l a.txt-rw-r--r--. 1 root root 0 Aug 26 05:30 a.txt[[email protected] ~]# ls -l --time=atime test.txt #访问时间-rw-r--r--. 1 root root 610 Aug 26 05:01 test.txt[[email protected] ~]# ls -l --time=ctime test.txt #修改属性与权限时间-rw-r--r--. 1 root root 610 Aug 23 05:04 test.txt[[email protected] ~]# ls -l test.txt #更改文件内容的时间-rw-r--r--. 1 root root 610 Aug 23 05:04 test.txt[[email protected] ~]# touch -a test.txt #更改文件的访问时间为当前时间[[email protected] ~]# ll --time=atime test.txt-rw-r--r--. 1 root root 610 Aug 26 05:26 test.txt[[email protected] ~]# touch -m test.txt #更改文件修改内容的时间[[email protected] ~]# ll test.txt-rw-r--r--. 1 root root 610 Aug 26 05:29 test.txt
Linux Commands---Touch