Access time, Modify time, and Change time in Linux

Source: Internet
Author: User


For Access time, Modify time, and Change time in Linux, inode information of files and directories contains three time-related content: Access time, modify time, and Change time. www.2cto.com uses a file as an example. for example, create a test File '1' and run the command stat to view its inode content. The following shows the Shell code $ stat 1 File: '1' Size: 6 Blocks: 8 IO Block: 4096 regular file Device: fd00h/64768d Inode: 117604369 Links: 1 Access: (0644/-rw-r --) Uid: (503/***) Gid: (100/users) Access: 11:56:06. 000000000 + 0800 Modify: 11:56:20. 000000000 + 0800 Change: 11:56:20. 000000000 + 0800 Access time refers to the time when the last program directly accesses a file (directory. example: Shell code $ cat 1 1 2 3 $ stat 1 File: '1' Size: 6 Blocks: 8 IO Block: 4096 regular file Device: fd00h/64768d Inode: 117604369 Links: 1 Access: (0644/-rw-r --) Uid: (503/***) Gid: (100/users) Access: 14:14:33. 000000000 + 0800 Modify: 11:56:20. 000000000 + 0800 Change: 11:56:20. 000000000 + 0800 the Access time has changed, but the other two items have not changed. modify time indicates the time when the last file (directory) content was modified. example: Shell code $ echo '4'> 1 $ stat 1 File: '1' Size: 8 Blocks: 8 IO Block: 4096 regular file Device: fd00h/64768d Inode: 117604369 Links: 1 Access: (0644/-rw-r --) Uid: (503/***) Gid: (100/users) Access: 14:14:33. 000000000 + 0800 Modify: 14:17:51. 000000000 + 0800 Change: 14:17:51. 000000000 + 0800 here, Modify time has changed. change time refers to the time when inode information of the last file (directory) is changed. in the above 'modify time' example, we can see that the Change time also changes. this is because after the file content is modified, the corresponding information will also change, such as the file Size 'SIZE '. if the inode information of a file (directory) is changed separately, the Change time is only affected. example: Shell code $ mv 1 2 $ stat 2 File: '2' Size: 8 Blocks: 8 IO Block: 4096 regular file Device: fd00h/64768d Inode: 117604369 Links: 1 Access: (0644/-rw-r --) Uid: (503/***) Gid: (100/users) Access: 14:14:33. 000000000 + 0800 Modify: 14:17:51. 000000000 + 0800 Change: 14:23:38. the operation above 000000000 + 0800 renamed the file '1', so it only affected the Change time. if you use the command 'Ls', there are three options: '-U','-t', and '-C', which correspond to Access time, respectively, modify time and Change time. with these options, the output of the command 'LS' will be sorted according to the corresponding time. by default, 'LS' uses Modify time, that is, the option '-t '. in addition, if 'LS' is used in combination with the '-- full-time' option, detailed time information can be displayed in the output.
 

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.