touch的基本用法

touch的基本功能是改变文件的时间戳,以下是三种常用用法:

1、创建一个空文件

以当前时间为时间戳创建一个空文件。
$ touch touch.txt //touch.txt不存在

2、更改文件时间戳

将指定的已有文件的修改时间和访问时间更改为当前时间,或指定时间。
$ touch test.txt //test.txt已存在

$touch -d '20141229 12:00:00' test.txt

3、批量更改文件时间

$ find . -name "*" -type f | xargs touch -d '20151229 14:22:00' 

posted on 2018-06-09 21:12  chenxiaopang  阅读(911)  评论(0)    收藏  举报

导航