The difference between a soft link and a hard link under Linux

Source: Internet
Author: User

In a Linux system, there are two kinds of links: one is called hard link (hardlink), the other is called symbolic link or soft link (symbolic).

1 ) How to create :

a ) By default without parameters, LN The command creates a hard link, and the ln command with the-s parameter creates a soft link.

2 ) meaning :

a ) hard-link files and source files Inode Node number is the same , and a soft link file is equivalent to a shortcut under Windows (the Inode node number differs from the source file)

3 ) features :

a You cannot create a hard link to a directory, but you can Create a soft link , a soft link to the directory is often used

b Soft links can cross file systems, hard links can not cross file systems. ,

4 why not (source files, soft links, hard links with delete)

a ) Delete the soft link file, the source files and hard-linked files have no effect;

b) Delete the hard-link file of the file, the source files and soft link files have no effect;

c) Delete the source file of the linked file, no impact on the hard-link file, it will cause its soft link failure (red white blinking);

d) while deleting the source file and its hard-linked file, the entire file will be "truly " the deletion

The difference between a soft link and a hard link under Linux

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.