更新文件,但不更改文件修改日期.可以吗?

AD.*_*AD. 4 linux

在Linux中,我可以更改文件内容,但保留该文件的相同修改日期吗?如果是,那怎么样?谢谢.

bil*_*aha 9

获取文件的修改日期.更改文件内容,然后您可以通过touch命令更改修改日期.例如

touch -m -t 09082000 file
to change the modification time to 8 sep, 20:00.
Run Code Online (Sandbox Code Playgroud)

您也可以将修改日期更改为过去,对于10/15/1998 12:30,命令将是这样的:

touch -m -t 19981015123000 file
Run Code Online (Sandbox Code Playgroud)