Unlink
Unlink is the removal of a directory entry that names a file, without invalidating the file's other hard links or existing open references.
Linux unlink() removes a name; if that was the last hard link, existing open references can keep the file usable after its pathname disappears. Reclamation depends on releasing the remaining references, not merely removing one pathname. A symbolic-link argument removes the symbolic link itself, not its target. Plain unlink() does not remove directories; unlinkat() with AT_REMOVEDIR requests directory removal instead. Namespace removal is not secure erasure or proof of crash-persistent deletion.
Relations
- related
- inode, hard-link, atomic-rename, open-file-description, directory-fsync
Advantages
- Allows a name to be removed without interrupting existing users of the open file.
Limitations
- Other hard links and open references can preserve the file after the name is removed.
- Does not promise physical erasure or persistent deletion after a crash.