Chapter III Linux Soft links and hard links

Source: Internet
Author: User

Linux Soft links with hard links

Deepen understanding through experimentation

[[Email protected]]$ Touch F1 # Create a test file F1

[[Email protected]]$ LN F1 F2 # Create a hard connection file for F1 F2

[[Email protected]]$ ln-s F1 F3 # create a symbolic connection file F1 that is a soft link

[[Email protected]]$ ls-li # -I parameter displays inode node information for a file

Total 0

9797648-rw-r--r--2 Oracle Oinstall 0 APR 08:11 F1

9797648-rw-r--r--2 Oracle Oinstall 0 APR 08:11 F2

9797649 lrwxrwxrwx 1 Oracle oinstall 2 APR 08:11 f3-f1

As can be seen from the above results, the hard connection file F2 the same as the Inode node of the original file F1 , both 9797648, but the inode of the symbolic connection file nodes are different.

[Email protected]]$ echo "I am F1 file" >>f1

[Email protected]]$ Cat F1

I am F1 file

[Email protected]]$ cat F2

I am F1 file

[Email protected]]$ cat F3

I am F1 file

[Email protected]]$ rm-f F1

[Email protected]]$ cat F2

I am F1 file

[Email protected]]$ cat F3

Cat:f3:No such file or directory

As you can see from the above test, hard connection F2 is not affected when the original file F1 is deleted, but the symbolic connection F1 file is not valid


This article is from the "Asteroid" blog, please be sure to keep this source http://3203180.blog.51cto.com/3193180/1876675

Chapter III Linux Soft links and hard links

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.