欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

touch修改文件時間或者創(chuàng)建文件

功能:對已經(jīng)存在文件的時間進(jìn)行修改,存取時間(access time)、修改時間(modification time)。對不存在的文件,進(jìn)行創(chuàng)建新的空白文件。

創(chuàng)新互聯(lián)是網(wǎng)站建設(shè)專家,致力于互聯(lián)網(wǎng)品牌建設(shè)與網(wǎng)絡(luò)營銷,專業(yè)領(lǐng)域包括成都做網(wǎng)站、網(wǎng)站設(shè)計、外貿(mào)營銷網(wǎng)站建設(shè)、電商網(wǎng)站制作開發(fā)、微信小程序、微信營銷、系統(tǒng)平臺開發(fā),與其他網(wǎng)站設(shè)計及系統(tǒng)開發(fā)公司不同,我們的整合解決方案結(jié)合了恒基網(wǎng)絡(luò)品牌建設(shè)經(jīng)驗(yàn)和互聯(lián)網(wǎng)整合營銷的理念,并將策略和執(zhí)行緊密結(jié)合,且不斷評估并優(yōu)化我們的方案,為客戶提供全方位的互聯(lián)網(wǎng)品牌整合方案!

短選項(xiàng)長選項(xiàng)含義
-a–time=atime
或–time=access
或–time=use
只更改存取時間
-m–time=mtime只更改變動時間
-d TIME–-date=字符串設(shè)定時間與日期,可以使用各種不同的格式
-t STAMP
設(shè)定時間戳。STAMP是十進(jìn)制數(shù): [[CC]YY]MMDDhhmm[.SS]
CC為年數(shù)中的前兩位,即”世紀(jì)數(shù)”;YY為年數(shù)的后兩位,即某世紀(jì)中的年數(shù)。如果不給出CC的值,則touch將把年數(shù)CCYY限定在1969–2068之內(nèi)。
MM為月數(shù),DD為天將把年數(shù)CCYY限定在1969–2068之內(nèi).MM為月數(shù),DD為天數(shù),hh 為小時數(shù)(幾點(diǎn)),mm為分鐘數(shù)SS為秒數(shù).此處秒的設(shè)定范圍是0–61,這樣可以處理閏秒。
這些數(shù)字組成的時間是環(huán)境變量TZ指定的時區(qū)中的一個時間。由于系統(tǒng)的限制,早于1970年1月1日的時間是錯誤的
-r FILE
把指定文檔或目錄的日期時間,統(tǒng)統(tǒng)設(shè)成和參考文檔或目錄的日期時間相同
-c–no-create不建立任何文檔

Linux的多個time屬性
access time是文檔最后一次被讀取的時間。因此閱讀一個文檔會更新它的access時間,但它的modify時間和change時間并沒有變化。cat、more 、less、grep、sed、tail、head這些命令都會修改文件的access時間。 
change time是文檔的索引節(jié)點(diǎn)(inode)發(fā)生了改變(比如位置、用戶屬性、組屬性等)。chmod, chown,create,mv等動作會將Linux文件的change time修改為系統(tǒng)當(dāng)前時間。
modify time是文本本身的內(nèi)容發(fā)生了變化。[文檔的modify時間也叫時間戳(timestamp).] ls命令看到的是modify time。用vi等工具編輯一個文件保存后,modify time會被修改。

創(chuàng)建新文件 
[root@GChan ~]# ls -l new.txt 
ls: new.txt: 沒有那個文件或目錄 
[root@GChan ~]# touch new.txt 
[root@GChan ~]# ls -l new.txt 
-rw-r--r-- 1 root root 0 10-11 22:40 new.txt 
[root@GChan ~]# 
 
 
更改文件時間為當(dāng)前時間 
[root@GChan ~]# ls -l new.txt 
-rw-r--r-- 1 root root 0 10-11 22:40 new.txt 
[root@GChan ~]# touch new.txt 
[root@GChan ~]# ls -l new.txt 
-rw-r--r-- 1 root root 0 10-11 22:41 new.txt 
 
 
更改文件時間為指定時間 
[root@GChan ~]# date 
2010年 10月 11日 星期一 22:42:54 CST 
[root@GChan ~]# touch -t 10112200 new.txt   <=== 格式 MMDDhhmm 
[root@GChan ~]# ls -l new.txt 
-rw-r--r-- 1 root root 0 10-11 22:00 new.txt 
[root@GChan ~]# touch -t 200910112200 new.txt   <=== 格式 yyyyMMDDhhmm 
[root@GChan ~]# ls -l new.txt 
-rw-r--r-- 1 root root 0 2009-10-11 new.txt 
[root@GChan ~]# 
 
[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 
[root@localhost test]# touch -t 201211142234.50 log.log   201211142234.50時間戳  
[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 2012-11-14 log.log 
 
將 file 的時間記錄改成 5 月 6 日 18 點(diǎn) 3 分,公元兩千年。時間可以使用 am, pm 或是 24 小時的格式,日期可以使用其他格式如 6 May 2000。 
touch -d "6:03pm" file 
touch -d "05/06/2000" file 
touch -d "6:03pm 05/06/2000" file 
 
 
將文件時間改成與別的文件相同 
[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

本文題目:touch修改文件時間或者創(chuàng)建文件
URL分享:http://chinadenli.net/article14/giegde.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、定制網(wǎng)站、網(wǎng)站設(shè)計公司、網(wǎng)站內(nèi)鏈、網(wǎng)站制作、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)