N-day learning of a Linux command ln

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.