Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
A soft link will create a link directly to the original file and a hard link creates a copy of the original file and updates them both if either one is updated.
So what exactly is the purpose in their difference?
Sticky:
Throught permissions and gui's you find the 'Sticky' word. What does it mean and how does it affect things?
Originally posted by Will Soft links / Hard links:
A soft link will create a link directly to the original file and a hard link creates a copy of the original file and updates them both if either one is updated.
So what exactly is the purpose in their difference?
A hard link actually point the same cluster on the hard drive as the original filename.
It doesn't make a copy of the file.
A soft link only make link to the file name.
When deleteing the soft link the file remains but when you delete a
You can also prevent or allow web page users on your server to follow symlinks.
ummm.. it's a bit more complicated that just "if you delete this and that..."
in the hard drive inode table, every file has a list of the number of hardlinks set to it. if an existing file has a hard link added to it, then the link_count or whatever it's called is incremented. there are now two hard links to the same file. a hard link points to the spot on the harddrive where the file is. if the file is moved, then the hardlinks remain. both links are essentially exactly the same. if you delete one, the link_count is decremented. if the link_count is 0, then the file is deleted.
a softlink, by contrast, just points to the file name. it just says, don't look at this file, look at /usr/bin/something-else. if the actual file is moved, then the softlink is broken, and accessing it will give a file-not-found error.
Originally posted by isajera
[B]ummm.. it's a bit more complicated that just "if you delete this and that..."
in the hard drive inode table, every file has a list of the number of hardlinks set to it. if an existing file has a hard link added to it, then the link_count or whatever it's called is incremented. there are now two hard links to the same file. a hard link points to the spot on the harddrive where the file is.
Ok, I think I got that so far.
if the file is moved, then the hardlinks remain. both links are essentially exactly the same.
[B] So does that mean that if the file is moved the remaining hardlinks still get updated but not the original or does the updating stop if the original is moved.
if you delete one, the link_count is decremented. if the link_count is 0, then the file is deleted.
the 0 that would be the original file, right? or is the original file no longer really matter when it comes to hard links. ie; the original file can be deleted and the others still work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.