LinuxDifferences between soft and hard links
1: Soft link
Command:Ln-S
/Etc/inittab/test/inittab. Soft
View:Ls-l
/Etc/initab/test/inittab. Soft
The soft connection is similarWindows,->The address of the real file.
2: Hard link
Command:Ln/Etc/inittab
/Test/inittab. Hard
View:Ls-L
/Etc/inittab/Test/inittab. Hard
It is found that the size and creation date of the hard link are exactly the same as those of the real file, similarCopy, Synchronously update.
3: What is the difference between hard link and copy:
It is found that the creation date of the copy object is different from that of the real object.
4: If you want to copy data with the same date, run the following command:CP-P
/Etc/inittab/Test/inittab2
5: Synchronous update of hard links
A soft connection is similar to a shortcut. The source file is accessed, and all files must be synchronized with the source file.
The hard link is similar to a copy, but it has the synchronous update function. We can verify it again.
first, go to /test create a file in the directory link
(1) wear link soft connection file and hard link file, link. soft link. hard
(2) source file link write data
(3) View the content of the three files
Hardware-linked files and source files are synchronously updated
6: Impact of deleting source files on hard links and soft connections
A soft connection is similar to a shortcut. It does not work when the source file does not exist.
Hard links are copies and still exist.
7: Why can hard links be synchronously updated?
A file link and Its Soft link and hard link file,
run the ls-I , I the node numbers are the same, the kernel is based on the file I nodes are used to identify files, I the nodes are the same. All files are considered as one file, and all data is written and modified simultaneously.
8: Hard link requirements
Hard links cannot span file systems, that is, they cannot span partitions, similarWindowsCannotCHard link of the DiskDDisk. Soft links can be stored in any file system.