(GO) ln command

Source: Internet
Author: User

LN is a very important command in Linux. Her function is to create a synchronized link for a file in another location, the most commonly used parameter of this command is-S.

The specific usage is:

Ln-s Source File Destination file

-S is the meaning of symbolic.

When we need to use the same file in different directories, we do not need to put the same file in every required directory, we just put the file in a fixed directory, and then in the other directory with the ln command link she can, do not have to re-occupy disk space.

For example: Ln-s/bin/less/usr/local/bin/less-s is the code name (symbolic) meaning.

Here are two points to note:

The 1,LN command maintains the synchronization of each linked file. In other words, no matter where you change, the same changes occur in other files;

2,ln links are available in both soft and hard links. Soft link is ln-s * * *, it will only be in the location you selected to generate a file image, does not occupy disk space, hard link ln * *, no parameter-s, it will be in your selected location to generate a file with the same size as the source file, whether it is a soft link or a hard link, the file will remain synchronized changes. Soft links can span partitions, but hard links are only within the same partition. If you use LS to look at a directory, found that there is a file behind the @ symbol, that is, a file generated with the LN command, with the ls-l command to see the path of the link will be shown when we need to use the same file in different directories, We do not need to put in every required directory must be the same file, we just put the file in a fixed directory, and then in other directories with the ln command link (link) it can, do not have to repeatedly occupy disk space. Example: Ln-s/bin/less/usr/local/bin/less
Attention:

First, the LN command maintains the synchronization of each linked file, meaning that no matter where you change it, the other files will change the same.

Second, ln links and soft links and hard links two, soft link is ln-s * * *, it will only be in the location you selected to generate a file image, does not occupy disk space, hard link LN * * *, no parameter-s, it will be in the location you selected to generate a file with the same size as the source file, Files are kept in sync, whether they are soft links or hard links. Soft links can span partitions, but hard links are only within the same partition.
Third: The directory cannot establish a hard link, but can establish a soft link.

(GO) ln command

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.