unlink
The system call that removes one name from a directory and lowers the file's link count.
In more detail
rm calls unlink for each file you name. Unlinking removes a reference, not the data: the kernel frees the blocks only after the link count reaches zero and every process has closed the file. That is why a deleted log can keep using disk space until the service writing it restarts.
Related terms
- rm — The command that deletes files, and with -r whole directory trees, permanently.
- link count — The number stored in an inode that says how many directory entries point to it.
- deleted but open file — A file whose last name has been removed but whose data still uses disk space because a process keeps it open.
- system call — A request a program makes to the kernel, such as open this file or start a new process.
Taught in
- Inodes, Hard Links And What rm Removes — Linux Fundamentals & Systems Administration