系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux修改文件的時(shí)間

Linux系統(tǒng)如何修改文件的時(shí)間

時(shí)間:2015-11-05 15:48:11 作者:zhijie 來源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20151105/61115.html 手機(jī)查看 評(píng)論

  Linux系統(tǒng)文件創(chuàng)建的時(shí)間并不是不能修改的,通過touch命令可以修改文件的時(shí)間,從而達(dá)到以假亂真的效果。下面就來介紹一下Linux系統(tǒng)如何修改文件的時(shí)間。

  關(guān)于touch命令的描述:

  -d, --date=STRING

  parse STRING and use it instead of current time

Linux系統(tǒng)如何修改文件的時(shí)間

  touch的參數(shù)說明:

  命令參數(shù):

  -a 或--time=atime或--time=access或--time=use  只更改存取時(shí)間。

  -c 或--no-create  不建立任何文檔。

  -d 使用指定的日期時(shí)間,而非現(xiàn)在的時(shí)間。

  -f 此參數(shù)將忽略不予處理,僅負(fù)責(zé)解決BSD版本touch指令的兼容性問題。

  -m 或--time=mtime或--time=modify  只更改變動(dòng)時(shí)間。

  -r 把指定文檔或目錄的日期時(shí)間,統(tǒng)統(tǒng)設(shè)成和參考文檔或目錄的日期時(shí)間相同。

  -t 使用指定的日期時(shí)間,而非現(xiàn)在的時(shí)間。

  --no-create 不會(huì)建立新檔案。

  --help 列出指令格式。

  --version 列出版本訊息。

  此處就使用簡單的修改文件時(shí)間。

  實(shí)例:將系統(tǒng)里某些文件修改為三個(gè)月前的時(shí)間:

  當(dāng)前系統(tǒng)文件信息如下:

  [root@case test]# ls -l

  total 28

  drwxr-xr-x 2 root root 4096 Jan 9 15:47 1333

  -rwxrwxr-x 1 oracle oinstall 8143 Jan 9 14:41 3.sh

  drwxr-xr-x 2 root root 4096 Jan 9 15:49 444

  -rw-r--r-- 1 root root 0 Jan 9 14:41 4.sh

  -rwxr-xr-x 1 root root 8143 Jan 9 14:44 77.sh

  -rwxrwxr-x 1 root root 54 Jan 9 16:03 find.sh

  把所有的.sh文件修改到三個(gè)月前(2015年10月13)的時(shí)間。操作命令:

  [root@case test]# touch -d “10/13/2013” *.sh

  結(jié)果是:

 。踨oot@case test]# ls -l

  total 28

  drwxr-xr-x 2 root root 4096 Jan 9 15:47 1333

  -rwxrwxr-x 1 oracle oinstall 8143 Oct 13 00:00 3.sh

  drwxr-xr-x 2 root root 4096 Jan 9 15:49 444

  -rw-r--r-- 1 root root 0 Oct 13 00:00 4.sh

  -rwxr-xr-x 1 root root 8143 Oct 13 00:00 77.sh

  -rwxrwxr-x 1 root root 54 Oct 13 00:00 find.sh

  另外也可以單獨(dú)修改時(shí)間或者月份,如下

  以使用 am, pm 或是 24 小時(shí)的格式,日期可以使用其他格式如 6 May 2000 。

  touch -d “6:03pm” file

  touch -d “05/06/2000” file

  touch -d “6:03pm 05/06/2000” file

  以上就是Linux系統(tǒng)修改文件的時(shí)間的方法了,這樣一來不管是用戶查看,還是系統(tǒng)識(shí)別的文件的創(chuàng)建時(shí)間都可以被改成幾個(gè)月以前的了。

標(biāo)簽 文件時(shí)間

發(fā)表評(píng)論

0

沒有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

掃碼關(guān)注
掃碼關(guān)注

掃碼關(guān)注 官方交流群 軟件收錄