47. Linux Shell and LN links

Source: Internet
Author: User

1. Create multiple entries or access points for the same file.

1) hard link: both the original file name and the connection file name point to the same physical address, that is, the original file and the hard connection file are the same file (not a copy ), the two files occupy the same index point (equivalent to the reference count plus 1 ). After a hard connection is created for the file, the number of connections to the file is increased by 1. The directory cannot have a hard link. Cross-file system is not supported.

Hard connection refers to the connection through the index node. The role is to allow a file to have multiple valid path names.

2) Symbolic connection

The number of connections does not increase, which is equivalent to the shortcut in windows. Occupies an index node.

Ls-I [file path]

Ln-[f/S] [Existing file path name] [link file path]

-F remove existing destination files

-S make symbolic links instead of hard links

2. Example

1) hard link

-RW-r -- 2 root Root 22 Sep 28 05:08 Test

-RW-r -- 2 root Root 22 Sep 28 05:08 test1

Lrwxrwxrwx 1 Root 4 Sep 28 05:08 Test2-> Test

Ls-I, same inode

Ll View

Generate a symbolic link: ZZ

Ln-s YY ZZ

Generate a hard link: ZZ

Ln YY xx

Reference

[1] http://linux.chinaunix.net/man/2004-10-06/45.shtml

Http://space.itpub.net/519536/viewspace-591175

Related Article

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.