What is the difference between soft link and hard link in unix operating system ?

Showing Answers 1 - 11 of 11 Answers

Pallavii Potdaar

  • Feb 15th, 2006
 

Hard Links :

1. All Links have same inode number.

2.ls -l command shows all the links with the link column(Second) shows No. of links.

3. Links have actual file contents

4.Removing any link ,just reduces the link count , but doesn't affect other links.

Soft Links(Symbolic Links) :

1.Links have different inode numbers.

2. ls -l command shows all links with second column value 1 and the link points to original file.

3. Link has the path for original file and not the contents.

4.Removing soft link doesn't affect anything but removing original file ,the link becomes "dangling" link which points to nonexistant file.

skartik

  • Apr 3rd, 2006
 

Soft link:-This is a Symbolic link between files.The actual file or directory , must be residing at any available partitions of the harddisk, Soft Link is just a "shortcut" (in windows terms) or "link" created with a new file name at the working directory or at current working partition of hard disk.Even when you don't require it, you can confidently delete this "soft link" as it doesn't remove the actual file or directory.The reason is, the actual file or diretcory's inode is different from the "softlink" created file's inode, in any unix system.Hard link:-It is the replica of the actual file or directory , which must be residing at any available partitions. This is a duplicate file copy of it's orginal , which can be created at current , working partition.When we remove or delete , this hardlink, it removes the original file or directory too.The reson is , they share the same inode , in any unix file system.With regards,Siddhun.M.Karthik

malathi

  • Apr 30th, 2006
 

softlink is useful when you want to refer files from other computer /filesystem through NFS .hard link doesn't allow this.

  Was this answer useful?  Yes

cfsaju

  • Sep 4th, 2006
 

Hey, Look at the basic difference and the facts btw soft link and hard link. Soft link can span across file system Hard link cannot span across file system Soft link have different inod numbers ( ls -li) Hard link have same inod number for all files Soft link can link directories and files Hard link can only link files not directories You can create non existing files with the soft link Hardware link fails if the source files dont exists. If you remove the source files, soft link will not work . Remove the source files in hard link , still data will be available if its a hard link. Usage : ln -s source file target file ( soft link)Usage :ln source file target file ( hard link)Send your solaris queries to support.solaris@gmail.com.

  Was this answer useful?  Yes

harish

  • Nov 26th, 2006
 

hi....regarding hard link .... the original file will not be deleted when you delete the hard linkit ll be deleted only when the link count becomes zero

poornimay

  • May 22nd, 2008
 

In Hardlink Inode is same and both are independent
In Softlink Inode is diff and the linked file will b a shortcut of first file

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions