Linux Command Learning (11): Link file command

Source: Internet
Author: User
The command ln for linking files has never been well understood and depressing. But now I don't want to spend too much time on Linux commands, so I will first talk about what I know, and then I will understand it in practice.
The result of the ln command is similar to the shortcut in windows. You can access the same file from different paths. However, it is similar to shortcuts.
There are two types of file links: hard link and symbolic link. The descriptions are as follows:

Hard link: a hard link registers an object in multiple directories. For example, the file file1 was originally in directory A, and then added a hard link to file 1 in directory B. Then, the file can be seen in both directory A and directory B. The number of hard links in this file is 2.
Hard links have a few restrictions:
(1) The directory file cannot be hard linked.
(2) hard links cannot be made between different file systems. That is to say, to establish a hard link, it must be built on the same file system.

Symbolic Link: the symbolic link actually links a file in B, and then the file in B points to.

The ln command format is as follows: ln [Option] source file [target file], where-s option indicates that a symbolic link is added, and hard links are added by default.

The following is an example I used a few days ago. I have a folder on the mounted disk and often need to access it, but it looks awkward. So I want to create a link on the desktop. Assume that I am under my directory, and the current folder contains the Desktop Folder, enter the following command to create a link: ln-S/Windows/hdc7/ebook. /desktop/allebook, OK. A folder already exists on the desktop.
In addition, what I want to talk about is just my understanding. Because of the short schedule, I simply read it. An incorrect understanding may occur. Do not mislead anyone who can see this word.

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.