Linux file creation time, access time, modification time and change time

Source: Internet
Author: User
Tags chmod
You can view the status of a file through the stat command
You can see that the file's access time, modification time, and change time are 13:36:55. This is also the time when the file was created, because no access, modification, or change occurred after the file was created.

Access Time (Accesstime): reads the contents of a file at a time that is updated. For example, use the less command or the more command on this file. (LS, stat commands do not modify file access time)

You can see that the access time for files after using the More\less\cat command changes to the time of the last visit, and that the file's modification time and change time did not change.

As you can see, file properties are listed using the Ls\stat command for files, and the access time for files after displaying file state has not changed, because these procedures do not read the contents of the file itself.

Ø modified Time (modifytime): Changes to the contents of the file will update the time. For example, using tools such as vim to change the contents of the file and save, the file modification time changed. The time that is listed through Ls–l is this time. You can use the Ls–ul command to see the file access time.

The current file status.

Use the vim edit file to save the file after you add "test file access Time,modify time,change time" to view the status of the file, and you can see changes in the file's modification times. However, it is noteworthy that the file access time and change time have also changed. What's the question? This is because we open the file through Vim is actually also accessed the file so file access time is updated, and when the content is added and saved after the file size, block number, time data and other states also changed, so its state change time is also updated. That is to say, modifying the contents of a file often updates the state of the file and the time it is accessed, but not absolute. The example below will explain the situation.

This time we only open the file through VIM, do not make any edits to save the file, see the file access time has changed and change the time and status change time has not been updated. This confirms that the use of Vim to edit the file is actually the first access to the file statement. It also shows that as long as the content does not change, the file modification time remains unchanged.

The ls–l command displays the file's modification time, and the Ls–ul command displays the file's access time.

Ø Change Time (changetime): Changing the properties of a file updates that time, such as using the chmod command to change file properties, or when executing other commands implicitly changing the file's properties, such as file size.

Current access time, modification time, state change time.

View file status after executing chmod command The status change time is updated. The access time and modification time remain unchanged because the process does not read the contents of the file or change the contents of the file

Changing the contents of a file by redirecting the command updates the file's modified time and state change time. Because this process modifies the contents of the file, changes the file size, modification time, and so on, and does not read the contents of the file. This also verifies that "modifying file content often updates the state of the file and the time it is accessed, but not absolute." "This statement

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.