码迷,mamicode.com
首页 > 系统相关 > 详细

linux命令---touch

时间:2018-08-25 21:50:24      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:linux命令   ctime   ls -l   常用   atime   修改   time   文件   限时   

touch: change file timestamps 更改文件时间戳
常用选项:
-a 更改文件的访问时间为当前时间
-m 更改文件的修改内容时间为当前时间
-c 更改文件的ctime时间为当前时间,即修改文件的属性与权限时间
实例:

[root@www ~]# touch a.txt   #创建空文件,常用
[root@www ~]# ls -l a.txt
-rw-r--r--. 1 root root 0 Aug 26 05:30 a.txt
[root@www ~]# ls -l --time=atime test.txt      #访问时间
-rw-r--r--. 1 root root 610 Aug 26 05:01 test.txt
[root@www ~]# ls -l --time=ctime test.txt      #修改属性与权限时间
-rw-r--r--. 1 root root 610 Aug 23 05:04 test.txt
[root@www ~]# ls -l test.txt                          #更改文件内容的时间
-rw-r--r--. 1 root root 610 Aug 23 05:04 test.txt
[root@www ~]# touch -a test.txt                  #更改文件的访问时间为当前时间
[root@www ~]# ll --time=atime test.txt
-rw-r--r--. 1 root root 610 Aug 26 05:26 test.txt
[root@www ~]# touch -m test.txt                #更改文件修改内容的时间
[root@www ~]# ll test.txt
-rw-r--r--. 1 root root 610 Aug 26 05:29 test.txt

linux命令---touch

标签:linux命令   ctime   ls -l   常用   atime   修改   time   文件   限时   

原文地址:http://blog.51cto.com/12107790/2164382

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!