LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Kinds of links in Linux and use of unlink (https://www.linuxquestions.org/questions/linux-newbie-8/kinds-of-links-in-linux-and-use-of-unlink-4175540065/)

FilipN 04-18-2015 05:44 AM

Kinds of links in Linux and use of unlink
 
Hello, I am learning about file types in Linux, and i see there are hard and symbolic links, also I saw that unlink function in C deletes a link to a file and decrements the intern link counter. The problem is that i don't understand what link is deleted when unlink is called. Is it the parents link to that file?

smallpond 04-18-2015 07:15 AM

A normal file has one hard link, a directory entry which points to the inode for the file. The inode keeps track of the number of hard links. When you unlink the last one, the file is gone. The link removed by unlink is the one that is passed to it when it is called.

FilipN 04-18-2015 08:31 AM

Thank you very much. This made things clear.


All times are GMT -5. The time now is 03:25 AM.