Difference between a soft link and a hard link

A "file" consists of the blocks of data in a file, and metadata describing the file (such as the filename).

Using this terminology, a hard link points to the data, and a soft link (also called a symlink or symbolic link) points to the file. Every file has at least one hard link, but not every soft link points to a file.

This explains why the Unix command for deleting a file is called "unlink." When you unlink a file, what you're really doing is removing a hard link to the file data, and when the last hard link to that file data is removed, the system removes the data, too (well, it doesn't delete the data, but it marks it as free).

Categories

About this Entry

This page contains a single entry by Mike Tsao published on February 18, 2004 9:35 AM.

script was the previous entry in this blog.

How to kill all processes having a certain name is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.2-en