日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

Linux如何使用命令更新文件目錄時間

Linux系統(tǒng)中touch命令是更新目錄或文件進行時間日期的命令,不過還有許多用戶對touch命令還不太清楚,因此,小編今天就給大家介紹一下touch命令的用法吧 。

Linux如何使用命令更新文件目錄時間


touch命令使用技巧:
名稱:touch
使用權(quán)限:所有使用者
使用方式:
touch [-acfm]
[-r reference-file] [--file=reference-file]
[-t MMDDhhmm[[CC]YY][.ss]]
[-d time] [--date=time] [--time={atime,access,use,mtime,modify}]
[--no-create] [--help] [--version]
file1 [file2 ...]
說明:
touch 指令改變檔案的時間記錄 。ls -l 可以顯示檔案的時間記錄 。
參數(shù):
a 改變檔案的讀取時間記錄 。
m 改變檔案的修改時間記錄 。
c 假如目的檔案不存在,不會建立新的檔案 。與 --no-create 的效果一樣 。
f 不使用,是為了與其他 unix 系統(tǒng)的相容性而保留 。
r 使用參考檔的時間記錄,與 --file 的效果一樣 。
【Linux如何使用命令更新文件目錄時間】 d 設(shè)定時間與日期,可以使用各種不同的格式 。
t 設(shè)定檔案的時間記錄,格式與 date 指令相同 。
--no-create 不會建立新檔案 。
--help 列出指令格式 。
--version 列出版本訊息 。
使用范例:
實例一:創(chuàng)建不存在的文件
命令:
touch log2012.log log2013.log
輸出:
[root@localhost test]# touch log2012.log log2013.log
[root@localhost test]# ll
-rw-r--r-- 1 root root 0 10-28 16:01 log2012.log
-rw-r--r-- 1 root root 0 10-28 16:01 log2013.log
如果log2014.log不存在,則不創(chuàng)建文件
[root@localhost test]# touch -c log2014.log
[root@localhost test]# ll
-rw-r--r-- 1 root root 0 10-28 16:01 log2012.log
-rw-r--r-- 1 root root 0 10-28 16:01 log2013.log
實例二:更新log.log的時間和log2012.log時間戳相同
命令:
touch -r log.log log2012.log
輸出:
[root@localhost test]# ll
-rw-r--r-- 1 root root 0 10-28 16:01 log2012.log
-rw-r--r-- 1 root root 0 10-28 16:01 log2013.log
-rw-r--r-- 1 root root 0 10-28 14:48 log.log
[root@localhost test]# touch -r log.log log2012.log
[root@localhost test]# ll
-rw-r--r-- 1 root root 0 10-28 14:48 log2012.log
-rw-r--r-- 1 root root 0 10-28 16:01 log2013.log
-rw-r--r-- 1 root root 0 10-28 14:48 log.log
上一頁12下一頁 剩下全文

    推薦閱讀