Does using rm on a symlink or a hard-link remove the source in addition to the link? Is there a good way to delete a hard-link or a symlink without deleting the source?

And if there is a good way outside of rm, would it be a good idea to use this more frequently instead of rm?


rm always removes a link. If it's the last one, the space allocated to the file is reclaimed. However, removing a symlink doesn't affect its target, so it seems like you've been misled. If the file no longer has a name, how would you find it?

  • You're right, I must have done something wrong which may have mislead me. While it appeared using rm on a symlink deleted my file, I must have done something else to delete it and assumed it was rm-ing a symlink. – papermachine May 30 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.