①命令格式
touch [选项]... 文件名...
②命令功能
创建文件,修改时间戳
③最常用参数
-r 设置文档的时间戳为指定文件或者目录的时间戳
-t 设置文档的时间戳为指定的时间,而非系统时间,时间戳格式为 YYYYMMDDhhmm.SS
④例子
1:创建一个文件
[root@master120 temp]# touch hehe.txt
[root@master120 temp]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 14 14:10 hehe.txt
2:创建一堆文件,如果有的文件已存在,就改一下时间戳
[root@master120 temp]# touch hehe.txt haha.txt
[root@master120 temp]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 14 14:11 haha.txt
-rw-r--r-- 1 root root 0 Aug 14 14:11 hehe.txt
3:设置文档的时间戳为指定文件或者目录的时间戳
[root@master120 temp]# touch -r hehe.txt haha.txt
4:设定时间戳为指定的时间
[root@master120 temp]# touch -t 201408131455.55 hehe.txt
[root@master120 temp]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 14 14:11 haha.txt
-rw-r--r-- 1 root root 0 Aug 13 14:55 hehe.txt