1: Soft Link
Command: Ln–s/etc/inittab/test/inittab.soft
View: Ls–l/etc/initab/test/inittab.soft
Found a soft connection similar to Windows shortcut,-> represents the address of a real file
2: Hard Link
Command: Ln/etc/inittab/test/inittab.hard
View: Ls-l/etc/inittab/test/inittab.hard
The hard links are found to be exactly the same size and creation date as the real file, similar to copy, synchronized updates.
3: The difference between hard link and copy:
The found copy is different from the date the actual file was created.
4: If you want to replicate the same date, you can pass the command: CP–P/ETC/INITTAB/TEST/INITTAB2
5: Sync Update for hard links
Soft connections are similar to shortcuts, access is the source file, so it must be synchronized with the source files.
Hard links are similar to copies, but have the ability to synchronize updates, which we can verify.
First create a file link in the/test directory
(1) The soft connection file and the hard link file of the link are worn separately, Link.soft Link.hard
(2) Write data to the source file link
(3) View the contents of three files
Find hard link files synchronized updates with source files
6: Effects on hard links and soft connections after you delete the source files
A soft connection is similar to a shortcut, and it is not valid when the source file does not exist.
A hard link is a copy and still exists.
7: Why hard links can be updated synchronously?
Also creates a file link and its soft links and hard link files,
With the command ls–i, the hard link file and the source file are found to be the same as the I node number, and the kernel is based on the file's I node to identify the file, the same I node of the two files, all considered a file, all simultaneously write and modify the data.
8: Requirements of the hard link
Hard links cannot cross the file system, that is, you cannot cross partitions, similar to the hard links in C that cannot be placed in D on Windows. and soft links can be placed in any file system.