From FreeBSDwiki
Jump to: navigation, search

This command does exactly the same thing as rm : it removes files. If you have read the section about links you know that one file's contents can be read and write through one or more directory entries thanks to hard links. So the unlink command is the exact oposite of the ln command : it removes one link, and if no more links are available for the file contents, it will effectively disappear from the filesystem, and its contents will eventually be overwritten as other data is written to the filesystem.

The number of hard links for a file can displayed by the ls command.

Note that the C programming language primitive for deleting files is : unlink()

Personal tools