0x0 文件时间信息的查看
![](https://img.haomeiwen.com/i12506039/598a2c10493c675b.png)
Linux下的文件的三种时间属性
(1)Access time:文件最近访问的时间(cat 文件)
![](https://img.haomeiwen.com/i12506039/707c1b4c5c0b69f9.png)
(2)modify time:文件最近被修改过的时间(编辑文件)
![](https://img.haomeiwen.com/i12506039/b4bb560bb66fe609.png)
(3)Change time:文件或者目录被修改(搜索目录)或者文件的所有者、权限被修改,Change time就更新。
![](https://img.haomeiwen.com/i12506039/bf8e5b5d3542d7f6.png)
0x2 利用touch命令对文件时间进行修改
touch可以创建文件,也可以修改文件的时间
(1)touch命令修改文件Access time
# touch -a [file]
![](https://img.haomeiwen.com/i12506039/3a76785d32a67fbb.png)
(2)touch命令修改文件Modify time
#touch -m [file]
![](https://img.haomeiwen.com/i12506039/61dae4b0d8fe2512.png)
(3)touch命令修改文件Change time
#touch -c [file]
![](https://img.haomeiwen.com/i12506039/e1bef907786785f8.png)
(4)touch命令将文件时间修改为指定日期
# touch -d "appointed time” [file]
![](https://img.haomeiwen.com/i12506039/4d0588fdf166230c.png)
(5)touch命令将 file1的事件设置为file2的时间
# touch -r [file1] [file2]
![](https://img.haomeiwen.com/i12506039/7a3070adcba936f3.png)
网友评论