Linux系统修改文件时间的步骤过程详解
时间:2023-09-04 19:48:08
熟悉Linux系统的用户都知道,该系统文件创建的时间并不是不能修改的,通过touch命令可以修改文件的时间,从而达到以假乱真的效果。但是很多用户不知道如何修改,下面,我们就一起来看看Linux系统修改文件时间的步骤过程详解。
关于touch命令的描述:
-d, --date=STRING
parse STRING and use it instead of current time
Linux系统
touch的参数说明:
命令参数:
-a 或--time=atime或--time=access或--time=use 只更改存取时间。
-c 或--no-create 不建立任何文档。
-d 使用指定的日期时间,而非现在的时间。
-f 此参数将忽略不予处理,仅负责解决BSD版本touch指令的兼容性问题。
-m 或--time=mtime或--time=modify 只更改变动时间。
-r 把指定文档或目录的日期时间,统统设成和参考文档或目录的日期时间相同。
-t 使用指定的日期时间,而非现在的时间。
--no-create 不会建立新档案。
--help 列出指令格式。
--version 列出版本讯息。
此处就使用简单的修改文件时间。
实例:将系统里某些文件修改为三个月前的时间:
当前系统文件信息如下:
[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文件修改到三个月前(2015年10月13)的时间。操作命令:
[root@case test]# touch -d “10/13/2013” *.sh
结果是:
[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 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
另外也可以单独修改时间或者月份,如下
以使用 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
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win8系统内如何搜索软件?windows8操作系统搜索软件方法介绍
![](https://img.aspxhome.com/file/2023/29/a256290_0s.jpg)
如何在Mac的Word 2011中创建权限表?
![](https://img.aspxhome.com/file/2023/6/23086_0s.jpg)
word 2007存储为:*.doc快捷键的设置步骤
![](https://img.aspxhome.com/file/2023/3/19883_0s.jpg)
wps office怎么压缩?
怎样使用腾讯电脑管家测试网速?腾讯电脑管家测试网速教程
![](https://img.aspxhome.com/file/2023/7/a330059_0s.jpg)
WPS Excel单元格内如何另起一行输入
![](https://img.aspxhome.com/file/2023/4/a185734_0s.jpg)
Win10桌面如何添加天气小插件?Win10桌面添加天气小插件的技巧
![](https://img.aspxhome.com/file/2023/26/a221425_0s.jpg)
Win7系统如何直接升级Win10?Win7系统直接升级Win10教程
![](https://img.aspxhome.com/file/2023/26/a228220_0s.png)
复制的文章粘贴到WORD中一句话会断成好几段的解决办法
Win10怎么设置与win7共享打印机?
![](https://img.aspxhome.com/file/2023/7/51387_0s.png)
win10系统怎么获得管理员权限
![](https://img.aspxhome.com/file/2023/4/46494_0s.png)
Win10专业版IE浏览器故障怎么修复?Win10专业版IE浏览器故障修复
![](https://img.aspxhome.com/file/2023/26/a223363_0s.png)
PPT制作火焰字效果教程
![](https://img.aspxhome.com/file/2023/10/a352786_0s.png)
Win10系统怎么在任务栏显示联系人?Win10系统在任务栏显示联系人的方法
![](https://img.aspxhome.com/file/2023/8/52768_0s.png)
Tower for Mac怎么发布本地存储库?
Win11系统有什么缺点?Win11系统存在问题介绍
![](https://img.aspxhome.com/file/2023/1/a283596_0s.png)
Win10一周年更新正式版14393新增emoji表情符号超过52000个
![](https://img.aspxhome.com/file/2023/29/a261081_0s.jpg)
Win7系统安装韩语输入法的详细步骤
![](https://img.aspxhome.com/file/2023/4/a313140_0s.jpg)
WPS表格技巧—多种方式设置货币符号
win8系统蓝屏重启的原因及解决方法
![](https://img.aspxhome.com/file/2023/4/a304060_0s.png)