I have seen a comment about the
It basically means the space reserved for the said file is freed up for use within the system. All links to that file are removed, making the count
0 means no file, effectively freeing up the space.
unlink() will remove the link (the name of the file you specify) to the data which is coherently stored as (and referred to as) an inode.
When there are no more "links" to the data, the system automatically frees the associated space with that file. The number of links referenced to an inode are tracked right into the inode.
You can see how many links reference to a file by running the command
drwxr-xr-x 7 user Administ 4096 Nov 25 07:46 app drwxr-xr-x 5 user Administ 0 Nov 24 14:25 inc
5 are the respective links to the said file. Now when you run
unlink() and remove the record from the directory (making the link count
0) allows the system to free up the related space.
Why you ask?
Well when the links are
0 it means there are no links to the said data, effectively meaning there is no more link to the data, so it can be freed. Allowing you to use that freed up space.
This is exactly how hard linking and snapshots work.