linux命令基础篇4:touch

①命令格式

    touch [选项]... 文件名...shell

②命令功能

    建立文件,修改时间戳spa

③最经常使用参数

              -r    设置文档的时间戳为指定文件或者目录的时间戳code

              -t  设置文档的时间戳为指定的时间,而非系统时间,时间戳格式为 YYYYMMDDhhmm.SSorm

④例子

             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:建立一堆文件,若是有的文件已存在,就改一下时间戳ast

[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:设置文档的时间戳为指定文件或者目录的时间戳class

[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
相关文章
相关标签/搜索