The attributes of a Linux file or directory mainly include the node, type, permission mode, number of links, user and user group to which the file or directory belongs, recent access or modification time, and so on. The details are as follows:
Command:
Ls-lih
Output:
[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 Root 4.0 K 11-13 test3
2095131 drwxrwxr-x 2 root 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:
2095112-RW-r -- 1 Root 296 K 11-13 06: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:
[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.