Three kinds of time for files in Linux

Source: Internet
Author: User

Linuxthree kinds of time in the file

three kinds of time for files :

1. mtime file modification time

    1. The contents of the file change. This includes the number of empty cells in a file, the change of characters, and other actions that do not appear to affect the content of valid data.

    2. intentionally changing the timestamp. Eg: Use a command like touch–m–t 2016666666666fileName to deliberately change the mtime.

2. ctime file change Time

    1. The file's "Properties" change. Eg: permission to file, owner, group, etc.

    2. Mtime changes and man-made changes atime The situation,eg:touch–a–t 20166666 fileName ( Note: Because Access makes atime change, CTime is not going to change )

once the file's Mtime has changed, the CTime of the file changes as well.

3. atime file access time

This east is very unreliable,atime refers to the file access time, as a matter of truth, once the file is read, then the atime of this file will change, but atime is not at all reasonable, The actual situation is this:

    1. only Atime lag behind (equals) mtime atime< Span style= "font-family: ' Microsoft Jas Black ', ' sans-serif ';" And it will not change.

using a command such as echo or dd to change the contents of the file, only mtime and CTime have changed, and the atime of the file will not change. Because the content of the original text is not read, but when the Atime ahead of (equals)mtime or ctime ,cat|less|more View the file, at this time Atime hasn't changed, has it?

4. Summary:

    1. CTime can be remembered as the file attributes change time, users can not modify, or more reliable

    2. Mtime in the case of unintentional modification, it is also possible to accurately record the changes in the recent file time

    3. The last time you want to see a file through Atime is a pit, because Atime is ahead of CTime and mtime(while satisfying), Atime is not going to change.


Three kinds of time for files in Linux

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.