首页 > 解决方案 > 为什么 cp -p 不保留 ctime

问题描述

为什么 cp -p 不保留 ctime?

我认为所有时间戳都应该按照描述保留

   --preserve[=ATTR_LIST]
          preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all

[root@node101 test]# stat 1
  File: ‘1’
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d    Inode: 54395143    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-08-08 11:00:04.207486784 +0800
Modify: 2019-08-08 11:00:04.207486784 +0800
Change: 2019-08-08 11:00:04.207486784 +0800
 Birth: -
[root@node101 test]# cp -p 1 2
[root@node101 test]# stat 2
  File: ‘2’
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d    Inode: 54395144    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-08-08 11:00:04.207486784 +0800
Modify: 2019-08-08 11:00:04.207486784 +0800
Change: 2019-08-08 11:00:28.478788113 +0800
 Birth: -

标签: linuxtimestampcp

解决方案


推荐阅读