A link is a directory entry that points to blocks on disk. In other words every file on your system has at least one hard link. When you rm
a file the actual system call is unlink()
, it removes the directory entry. The blocks on disk haven't changed but the link is gone, thus the file is gone from the directory listing.
You personally may not ever use hard links, but they are all over your system. For example:
$ ls -li /bin | grep 53119771
53119771 -rwxr-xr-x 3 root root 26292 2010-08-18 10:15 bunzip2
53119771 -rwxr-xr-x 3 root root 26292 2010-08-18 10:15 bzcat
53119771 -rwxr-xr-x 3 root root 26292 2010-08-18 10:15 bzip2
You can see that bunzip2
, bzcat
and bzip
all use the same inode. In essence, it is one file with three names. You could have three copies of the file, but why? It would only use up disk space unnecessarily.