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
相關文章
相關標籤/搜索