Thursday 19 December 2013

Hard Link vs Soft Link - Unix

As you may be aware, in Unix we can create Links to point to a certain program or a file.

We create a link using ln command. We can create a symbolic link (also known as symlink) using the -s switch.

Eg:

ln -s /path to file1/file1.rtf /path to file2/file2.rtf

Now there are 2 types of links : a Hard link and a Soft link

Basically both types point to a certain file or a program. However one key difference is when the original file name is changed or modified.

If the name of original file is modified or renamed or if the original program is deleted from its location then:

a soft link is broken BUT a hard link does NOT break

Secondly, a Hard link cannot point to directories while a Soft link can link directories.


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker