Symbolic links and Hard links — What it is difference
hard links and symbolic links are methods that useful for find files in the operative system. how work? what it is difference? this questions, we will saw in the next sections. OK, for started we would know what is a inode, that is important because a inode is essential in the process.
What is an Inode?
In the operative systems UNIX exist a data base or manage of files, this manage of files is know like Inode. We saw that a inode is important in the process of find a file or several files, the inode is responsible of manage the features of a file, directory etc..
OK now we knowing what is inode, we will saw all the features of hard links and symbolic links
A hard link is a reference or pointer a an file in a operative system, each hard link is a copy exact of the rest files, data, permissions, owner etc. the hard links associate two or more files sharing the same inode.
A symbolic links indicates a access a an directory o file that have a address different in structure of files. A change made with this link will saw in the original but for the contrary if this link erase, the original not erase.
The command ln
The Ln command is a standard Unix command utility used to create hard or symbolic links to an existing file or directory. The use of hard links allows multiple file names to be associated with the same file, since a hard link points to the inode of a given file, the data of where it is stored on disk. On the other hand, symbolic links, also called “soft”, are special files that name other files by their file name. Ln by default creates hard links, and when invoked with the Ln -s parameter it creates symbolic links. The basic syntaxis is the next.
ln [-s] <file / directory> <name of link or directory source>
What is the difference between the two types of links
The difference is the type of pointer. A symbolic link points to another file by name. It has a special mode bit that identifies it as a symbolic link, and its content is the name of the actual file. Because it only contains a name, that name does not actually have to exist, or it may exist on a different file system. If you replace the named file (change its content without affecting its name), then the link still contains the same name, so it now points to the new file. You can easily identify a symbolic link and see the name of the file it points to.
A hard link points to the file by inode number. As such, hard links are no different from the name of a file. There is no “real” name versus a hard link name; All hard links are equally valid names for the file. Because of this, the file to link to must exist and be on the same file system where you are trying to link. If you delete the original name, then the hard link still points to the same file. Because all hard links are equally valid names for the file, you cannot look at one and see the other names for the file; To find this you have to look through each file and compare their inode number to find the other name (s) that have the same inode number.