Setting hard links, symbolic links, and performing queries
We saw earlier that a directory is treated in a file system similarly to a regular file. But it has a different file type, and it contains a list of filenames with their inodes. Inodes are data structures that contain metadata about a file such as an inode number (to uniquely identify the file), permission, ownership, and so on. In Unix/Linux, the first column in the output of an ls –li
command shows the inode number corresponding to a file, as shown here:
Since a directory contains a listing that maps filenames with inode numbers, there can be multiple filenames that map to the same inode number. Such multiple names are called hard links, or simply links. Hard links in Unix/Linux are created using the ln
shell command. Not all non-UNIX filesystems support such hard links.
Within a file system, there can be many links to the...