General
cancel
Showing results for 
Search instead for 
Did you mean: 

differnece and scenarions where we use soft and hard link?

Beginner_2
Occasional Advisor

differnece and scenarions where we use soft and hard link?

could anybody explain in easy and a bit detail that what is difference between soft and hard link.
mainly thier purposes of using and in what cases they are used . some examples
3 REPLIES
Tim Nelson
Honored Contributor

Re: differnece and scenarions where we use soft and hard link?

Hard links can be used in the same filesystem. A hard link simply shares the inode number of a file and gives it two names.

Soft links are used across filesystems. it is a pointer. Soft links can also be used in the same filesystem for readability. link_name -> real_file.

Most backup software and/or the find command will not traverse soft links, stopping them from backing up the same object multiple times.



Modris Bremze
Esteemed Contributor

Re: differnece and scenarions where we use soft and hard link?

A soft link (symlink) is like a shortcut in Windows. A hard link is more like a copy of the file whithout actually being duplicated. All hard links of a file share the same inodes, as mentioned. If you delete the original file, all hard links remain operational - you can still access the file. In case of soft links - delete the original file and the soft link no longer works.

This link has a bit more on the topic:
http://www.linuxclues.com/articles/17.htm
Steven Schweda
Honored Contributor

Re: differnece and scenarions where we use soft and hard link?

> A hard link is more like a copy of the file
> whithout actually being duplicated.

So it's not really like a copy.

> This link has a bit more on the topic:
> [...]

As do many, many others. Is Google broken,
or was there some other reason to ask this
here instead of doing even a basic Web
search? (Or buying a book?)