Operation and maintenance of 09 file attributes

① file attributes

ls -l /

Here Insert Picture Description
Common properties
1. File Type
2. file permissions
3. Link in amounts of
4 file owner
5. Group User file
size 6. file (in bytes)
7.8.9. Creation or modification time file
10. File name

① the first column of the file type

ll -d /etc/hosts /tmp /bin/ls  /dev/vda /dev/tty1 /etc/grub2.cfg /dev/log

Here Insert Picture Description
(-): regular file (normal file, script file, the compressed file, the command file)
(D): Contents
(b): block device file (disk)
©: serial port device (terminal, a keyboard)
(S): sleeve Sockets files. Communication protocol between a process and the process
(l): Soft link file

② third column file link
user data: also known as file data block (data block), a data block is where the real log file contents;
metadata: Additional attributes of the file, such as file size, creation time, owner, etc., which there is also a thing called the inode number. In Linux, inode number metadata (inode is part of the metadata file but does not include the file name, inode number that is inode number) that uniquely identifies the file rather than the file name is. The file name is only for the convenience of people's memories and use the system to find the correct file or program data blocks through the inode number.

Hard link
if a inode number corresponding to multiple file names, these files are called hard links. In other words, a hard link is the use of multiple aliases for the same file or a hard link by link command ln created.

ln (link) source file destination
Here Insert Picture Description

Hard links share the same inode number is only a different file name, so hard link has the following characteristics:
A file has the same inode Block and the Data;.
B only to existing files created;.
C can not. cross-file system hard link is created;
. d directory can not be created, can only create the file;
. E delete a hard link file does not affect other files have the same inode number.

Soft connection

ln (link) -s source file destination
Here Insert Picture Description

Hard link and a soft link is different if the contents of the file stored in the user data block is the path name of another file, the file is a soft connection. Soft link is a regular file, just blocks was sort of special. Soft link has its own inode number and the user data block.

. A soft link has its own file attributes and permissions;
. B can create the soft link to a nonexistent file or directory;
. C soft link can be cross-file system;
. D soft link to create a file or directory;
E created. when the soft link, the link does not count i_nlink increase;
. f delete soft link does not affect the file pointed to, but if the point of the original file is deleted, the associated soft connection is called a dead link (that is dangling link, if they are the path to the file is re-created, dead links revert to the normal soft link).

Published 22 original articles · won praise 0 · Views 295

Guess you like

Origin blog.csdn.net/weixin_44648034/article/details/104775693