Newbie School: how to create a link in a Linux operating system

Source: Internet
Author: User
1: Use the cd command to set it as the main directory. cd2: use touch to create the file touchaa3 named aa: run the ls-l command to query the file ls-l you just saw. The following is displayed: -rw-r -- rr -- 1

1: Use the cd command as the main directory cd

2: use touch to create a file named aa: touch aa

3: run the ls-l command to query the ls-l file.

Shown below:-Rw-r -- rr -- 1 user usergroup 0 otc 22 10: 20 aa

4: Use the ln command to create a hard link named bb: ln aa bb

5: Use the ln-s command to create a soft link for aa, called cc: ln-s aa cc

6: Use the echo command and output to redirect to aa by adding "Yes". echo "Yes"> aa

7: Run cat aa and ls-l respectively to observe the changes of the three files.

Working principle:These links reference the same file, but they appear in different ways on the system. both soft links and hard links point to the same file, and editing them will modify the content of the original file, the difference between a soft link and a hard link is that when a file is deleted, the processing method is different. when the link and the file are located on different file systems, they use different methods.

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.