Objective
Sometimes the same file wants to create multiple aliases, this time you can use the link file instead
Use
Create a link to a file or directory and create a hard link by default
Hard Links
The Linux underlying file system consists of a super data block, a directory tree object, an inode index node object, and a file object. A hard link points to the same Inode node, which can be understood as a file alias, the directory cannot create a hard link, and you cannot create a hard link across the file system.
Soft links
Soft link is an ordinary file, has its own Inode index node, but the content of the storage is very special, the content of the store is pointing to the actual file content access path, the target source does not exist when you can create a soft link.
Common parameters
1. Link Backup already exists
-B
--backup[=control]
1) These 2 options are backup, the difference is that--backup can control the behavior of the backup
2) Backup Behavior description
None, off unprepared
Numbered, t backup file name incremented by maximum number
Existing, nil exists as backup
Simple, never never back up
2. Specify the backup filename suffix, default is ~
-S,--suffix=suffix
3. Create a soft link
-S,--symbolic
4. Other
-D,-F,--directory
Allow the superuser to attempt-hard link directories (Note:
Would probably fail due to system restrictions, even for the
Superuser
-F,--force
Remove existing destination files
-I.,--interactive
Prompt whether to remove destinations
-L,--logical
Make hard links to symbolic link references
-N,--no-dereference
Treat destination that's a symlink to a directory as if it were
A normal file
-P,--physical
Make hard links directly to symbolic links
Practice
1. Create a soft link to the catalog Test T
[Email protected]_m_test01 tmp]# ln-s Test T
Postscript
1. device files and socket files cannot create soft links
Resources
"1" Understanding hard links and soft links for Linux
Http://www.ibm.com/developerworks/cn/linux/l-cn-hardandsymb-links/index.html
"2" Man Ln
N-day learning of a Linux command ln