Access Time,modify time,change time for CentOS files

Source: Internet
Author: User

The metadata of the file can be viewed in CentOS via stat


[Email protected] abc]$ Stat Honey

File: ' Honey '

size:25 blocks:8 IO block:4096 Regular file

device:806h/2054dinode:131076 links:1

Access: (0664/-rw-rw-r--) Uid: (500/baby) Gid: (500/baby)

access:2015-03-30 10:27:51.851234105 +0800

modify:2015-03-30 10:44:58.144226717 +0800

change:2015-03-30 10:44:58.146226803 +0800


Access: Last Access time

Modify: Last Modified time

Change: The state changes time (maintained by the system, can not be arbitrarily modified)

TOUCH-A: Update only access time (while updating the change to current)

TOUCH-M: Update Modify time only(while updating the change to current)

TOUCH-C: Do not create a new file

TOUCH-T: Update the timestamp with the specified time (change Access time and modify Time,change to current times only)

Example: Touch-t [[CC]YY]MMDDHHMM[.SS] FileName


[Email protected] cde]# touch-t 199906121808 Honey

[Email protected] cde]# Stat Honey

File: ' Honey '

size:25 blocks:8 IO block:4096 Regular file

device:806h/2054dinode:131076 links:1

Access: (0664/-rw-rw-r--) Uid: (500/baby) Gid: (500/baby)

access:1999-06-12 18:08:00.000000000 +0800

modify:1999-06-12 18:08:00.000000000 +0800

change:2015-03-30 13:31:40.064221158 +0800


When any data of the file changes (including the file's data and metadata), the change is updated, the file is renamed (MV), moved (MV), or copied (CP-A), and the system updates the file's changing time. When the contents of a file are modified, modify and change are updated at the same time. When the change time is updated, access time is updated when Access is updated (only for access times) after the file is first accessed, and the access time is not updated.


[email protected] cde]$ Touch Honey


[Email protected] cde]$ Stat Honey

File: ' Honey '

size:25 blocks:8 IO block:4096 Regular file

device:806h/2054dinode:131076 links:1

Access: (0664/-rw-rw-r--) Uid: (500/baby) Gid: (500/baby)

access:2015-03-30 11:24:47.041225726 +0800

modify:2015-03-30 11:24:47.041225726 +0800

change:2015-03-30 11:24:47.041225726 +0800


[email protected] cde]$ Cat Honey &>/dev/null

[Email protected] cde]$ Stat Honey

File: ' Honey '

size:25 blocks:8 IO block:4096 Regular file

device:806h/2054dinode:131076 links:1

Access: (0664/-rw-rw-r--) Uid: (500/baby) Gid: (500/baby)

access:2015-03-30 11:25:16.401228081 +0800

modify:2015-03-30 11:24:47.041225726 +0800

change:2015-03-30 11:24:47.041225726 +0800


The first access after the timestamp is updated with touch, access time is updated, and the following is the metadata after the second visit, and access time is not updated.


[email protected] cde]$ Cat Honey &>/dev/null

[Email protected] cde]$ Stat Honey

File: ' Honey '

size:25 blocks:8 IO block:4096 Regular file

device:806h/2054dinode:131076 links:1

Access: (0664/-rw-rw-r--) Uid: (500/baby) Gid: (500/baby)

access:2015-03-30 11:25:16.401228081 +0800

modify:2015-03-30 11:24:47.041225726 +0800

change:2015-03-30 11:24:47.041225726 +0800



The tar or various compression commands will update the file's change time when extracting it, and if you want to change the changes time backup file you can use the DD command (the DD command will update the timestamp when copying a single file, preserving all the properties of the file when backing up the entire partition), as follows:

Create a new partition SDA10, not formatted and mounted to/MEDIA/SDA10.


[Email protected] cde]# ll/dev/sda10

BRW-RW----1 root disk 8, 12:58/dev/sda10


[[email protected] abc]# dd If=/dev/sda6 of=/dev/sda10 & (/dev/sda6 mounted in/tmp)

[1] 5917


[Email protected] abc]# mount/dev/sda10/media/sda10/


[Email protected] cde]# Stat/media/sda10/cde/honey/tmp/cde/honey

File: '/media/sda10/cde/honey '

size:25 blocks:8 IO block:4096 Regular file

device:80ah/2058dinode:131076 links:1

Access: (0664/-rw-rw-r--) Uid: (500/baby) Gid: (500/baby)

access:2015-03-30 11:25:16.401228081 +0800

modify:2015-03-30 11:24:47.041225726 +0800

change:2015-03-30 11:24:47.041225726 +0800

File: '/tmp/cde/honey '

size:25 blocks:8 IO block:4096 Regular file

device:806h/2054dinode:131076 links:1

Access: (0664/-rw-rw-r--) Uid: (500/baby) Gid: (500/baby)

access:2015-03-30 11:25:16.401228081 +0800

modify:2015-03-30 11:24:47.041225726 +0800

change:2015-03-30 11:24:47.041225726 +0800


The metadata for the two files is identical.


Access Time,modify time,change time for CentOS files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.