Spiga

Different 'soft link' and 'hard link' in Linux

(Question)

I have installed Fedora 8 and openSUSE on y system. While browsing the web for help on Linux, I often come across the terms 'soft link' and 'hard link'. Can you explain the different between the two?

(Answer)

In UNIX, files consist of two parts: the data part and the filename part. The data part is associated with an 'inode'. The inode is a data structure that stores information on files such as the user and group ownership, access mode (read, write, execute permissions) and the type of file for the data.

The filename part carries a name and an associated inode number. In some situations when more than one filename can reference the same inode number, then these files are said to be 'hard-linked' together. A 'hard-link' is another name for an existing file; the link and the original are indistinguishable.

Soft links are symbolic links (or symlinks), on the other hand. There are a special file type in which the data part actually refers to a different file, by name. When most operations (opening, reading,writing, and so on) are passed to the symbolic link file, the kernel automatically 'dereferences' the link and operates on the target of the link. But some operations (for example removing) work on the link file itself, rather than on its target.

You can refer to man pages of the ln command for more information on the topic.

myPendapat : Can somebody give more simple and easy explanation on above answer?

From Linux For You Magazine (Q and A Section)
Organize by Vipin Sharma from New Horizons India Ltd
Senior Corporate Manager - Technical



Related Posts by Categories



Widget by Hoctro | Jack Book

0 comments: