Detailed description of file attributes in linux

Source: Internet
Author: User
This article describes in detail the file attributes of the linux system, that is, the file information displayed when you use the ls command to list files. For more information, see Linux file or directory attributes: nodes, types, permission modes, number of links, users and user groups to which files or directories belong, and time of last access or modification. The details are as follows:
Command: ls-lih
Output:

Copy codeThe code is as follows: [root @ localhost test] # ls-lih
Total 316 K
2095120 lrwxrwxrwx 1 root 11 11-22 linklog. log-> log2012.log
2095112-rw-r -- 1 root 296 K 11-13 06:03 log2012.log
2095110-rw-r -- 1 root 61 11-13 06:03 log2013.log
2095107-rw-r -- 1 root 0 11-13 06:03 log2014.log
2095117-rw-r -- 1 root 0 11-13 06:06 log2015.log
2095118-rw-r -- 1 root 0 11-16 14:41 log2016.log
2095119-rw-r -- 1 root 0 11-16 14:43 log2017.log
2095113 drwxr-xr-x 6 root 4.0 K 10-27 0scf
2095109 drwxrwxr-x 2 root 4.0 K 11-13 test3
2095131 drwxrwxr-x 2 root 4.0 K 11-13 test4
Note:
Column 1: inode
Column 2: file types and permissions;
Column 3: Number of hard links;
Column 4: owner;
Column 5: Group;
Column 6: file or directory size;
Column 7 and Column 8: Last access or modification time;
Column 9: file name or directory name
Take log2012.log as an example:

Copy codeThe code is as follows: 2095112-rw-r -- 1 root 296 K 11-13 03 log2012.log
Inode value: 2095112
File type: the file type is-, indicating that this is a common file. for the file type, see: A linux command (24) every day: Linux file type and extension
File permission: The file permission is rw-r --, which indicates that the file owner is readable, writable, and unexecutable. the user group to which the file belongs cannot be written, readable, or unexecutable, other users cannot write, read, and execute;
Number of hard links: The file log2012.log does not have a hard link; because the value is 1, it is itself;
File owner: that is, the user to which the file belongs. it is root, that is, the first root;
File group: that is, the user group to which the file belongs is the root user group;
File size: the file size is 296kb;
Time when access can be modified: the time here is the last access time. the time when the last access and file are modified or created is sometimes not the same;
Of course, the attributes of the document include not only these attributes, which are the most common attributes.
About inode:
Inode is an index node. After the partition of each storage device or storage device (the storage device is a hard disk, floppy disk, or USB flash disk) is formatted as a file system, there should be two parts, one part is inode, another part is Block, which is used to store data. Inode is used to store the data, including the file size, owner, owner user group, and read/write permissions. Inode indexes information for each file, so there is an inode value. Based on commands, the operating system can find the corresponding files with the fastest inode value.
To make a metaphor, for example, a book, a storage device or partition is equivalent to this book. Block is equivalent to every page in the book, and inode is equivalent to the directory before this book. a book has a lot of content, if you want to find a part of the content, you can first check the directory to find the content we want to see as quickly as possible. Although not appropriate, it is still a relatively good image.
When we use ls to view a directory or file, if we add the-I parameter, we can see the inode node. for example:

Copy codeThe code is as follows: [root @ localhost test] # ls-li log2012.log
2095112-rw-r -- 1 root 302108 11-13 06:03 log2012.log
The inode value of log2012.log is 2095112. to view the inode of a file or directory, use the-I parameter of the ls command.

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.