Linux系统修改文件时间的步骤过程详解

时间:2023-09-04 19:48:08 

熟悉Linux系统的用户都知道,该系统文件创建的时间并不是不能修改的,通过touch命令可以修改文件的时间,从而达到以假乱真的效果。但是很多用户不知道如何修改,下面,我们就一起来看看Linux系统修改文件时间的步骤过程详解。

关于touch命令的描述:

-d, --date=STRING

parse STRING and use it instead of current time

Linux系统修改文件时间的步骤过程详解
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


标签:Linux系统,修改文件时间
0
投稿

猜你喜欢

  • Win8系统内如何搜索软件?windows8操作系统搜索软件方法介绍

    2023-07-26 22:24:13
  • 如何在Mac的Word 2011中创建权限表?

    2022-09-23 09:22:25
  • word 2007存储为:*.doc快捷键的设置步骤

    2023-12-07 22:01:44
  • wps office怎么压缩?

    2022-02-12 22:51:15
  • 怎样使用腾讯电脑管家测试网速?腾讯电脑管家测试网速教程

    2022-02-05 23:05:56
  • WPS Excel单元格内如何另起一行输入

    2023-01-13 15:08:24
  • Win10桌面如何添加天气小插件?Win10桌面添加天气小插件的技巧

    2022-12-07 08:42:38
  • Win7系统如何直接升级Win10?Win7系统直接升级Win10教程

    2022-11-15 21:04:42
  • 复制的文章粘贴到WORD中一句话会断成好几段的解决办法

    2023-11-30 15:42:06
  • Win10怎么设置与win7共享打印机?

    2023-12-12 23:03:57
  • win10系统怎么获得管理员权限

    2023-06-07 16:30:43
  • Win10专业版IE浏览器故障怎么修复?Win10专业版IE浏览器故障修复

    2022-09-26 10:38:00
  • PPT制作火焰字效果教程

    2023-06-02 22:47:20
  • Win10系统怎么在任务栏显示联系人?Win10系统在任务栏显示联系人的方法

    2022-10-01 17:03:14
  • Tower for Mac怎么发布本地存储库?

    2022-12-18 05:27:00
  • Win11系统有什么缺点?Win11系统存在问题介绍

    2023-09-26 16:59:40
  • Win10一周年更新正式版14393新增emoji表情符号超过52000个

    2022-03-01 12:24:13
  • Win7系统安装韩语输入法的详细步骤

    2023-03-26 00:57:35
  • WPS表格技巧—多种方式设置货币符号

    2022-03-31 06:36:40
  • win8系统蓝屏重启的原因及解决方法

    2022-12-03 11:18:53
  • asp之家 电脑教程 m.aspxhome.com