Linking Files
Linking Files
Linking Files
Links are pointers to files. Hard links point to the inode which holds the
metadata about a file in memory. More than one file can point to the same
inode. In essence, all of the filenames are just pointers to these inodes in
memory.
If you use the ls -l command, you will see the number after the file permissions.
This number tells you how many filenames are pointing to the same inode in
memory. To see this inode number, you can use the i option with ls.
$ ln file hard_link_file
This command will create a hard_link_file which is the link file to the same
inode that the original file points to.
Soft (symbolic) links are less permanent because they just hold the name of
the file they point to.
You can create them by addint the s option. These kind of links are useful if you
are pointing to a file on a different filesystem or if you are trying to create links
to a directory.
If you want to see the contents (the files) of the directory this link points to, add
the L option to the ls command.