On most system all file names are hard links. The name of the file is just a name that refers to the actual data stored on the disk. It is possible to create multiple names (hard links) for the same data stored on the disk, so the data stored on the disk can be modified from different locations. Simply put, if one hard link is modified, all hard links (including the original file) is modified. Hard links on Linux are made with the ln command. If the file '.myconf' allready exists, to create a hard link named '.conf' we'll write:
ln /path/to/.myconf /path/to/.conf
If '.conf' is modified, '.myconf' is modified as well. All hard links pointing to same original file have same characteristics of that file such as, amount of disk space used, file permissions and so on. Drawback of hard link is that it is hard to make a difference between it and the real file because they show all real file characteristics. Also, all hard links need to be located on the same filesystem.
Symbolic links serves the same purpose as hard links, but they only contain a path to original file, not all characteristics of a file, so they are easy to differentiate. To create symbolic link type:
ln -s /path/to/original/file /path/to/symlink
Symbolic links are more used than hard links.
No comments:
Post a Comment