Differences between linux stat commands and inode content-ctime, mtime, and atime

Source: Internet
Author: User

Linux stat command and inode content-differences between ctime, mtime, and atime 1. [root @ localhost tmp] # stat 1.txt File: '1.txt 'Size: 8 Blocks: 8 IO Block: 4096 regular fileDevice: 802 h/2050d Inode: 196617 Links: 1 Access: (0644/-rw-r --) Uid: (0/root) Gid: (0/root) Access: 21:43:54. 000000000 + 0800 Modify: 21:35:42. 000000000 + 0800 Change: 21:35:42. 000000000 + 0800 2. stat displays the inode content-inode contains the object metadata. The following content is provided: * number of bytes of the file * timestamp of the read, write, and execute permissions * file of the Group ID * file of the User ID * file of the file owner, there are three * links in total, that is, how many file names point to the location of the inode * file data block 3. IO Block: the size of the Logical block is 4096 bytes Blocks: the minimum physical Block is 512, i/O Block is 4096, so it takes up eight physical blocks, which means Access: atime Modify: mtime, modification time. Note that this is not the Creation Time, and m is not the make meaning Change: ctime, change time 4. How to query these three times through ls? Ls-lc filename: list the ctime ls-lu filename of the file list the atime ls-l filename of the file list the mtime of the file -- ll is displayed by default this time 5, these three time is not good difference, but the difference must be good, because many applications will consider the time, for example, when performing a synchronous backup, they will determine the time, and files later than the last backup time should be synchronized again, etc, this can also be used when files are searched for and when files are hacked. Atime: Access time, which is changed when the file is read or executed. commands such as cat and vi mtime are changed when the file content is changed, such as vi ctime: change Time: when the file tags, such as attributes, users, user groups, permissions, and content, are changed, such as chmod, chown, vi 6, and timestamp) it is one of inode content. From inode, we can understand that ctime refers to the last time inode was changed, mtime refers to the last time the file content was modified, and atime refers to the last time the file was opened. 7. atime may not be modified after accessing the file, because if the noatime parameter is used during the mount operation when the ext3 file system is used, the atime information will not be updated, I just don't want filesystem to make too many modifications to improve the reading efficiency.

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.