Pages

Creating a soft link.

symbolic links are used in linux to create a link to a folder or a file which is located in a different location, so that the same file or folder can be accessed from both the locations.
Softlinks are created using the command



Example:

If we have a file "temp1" in the path



And if we want to create a link to this file in the path



We can do it as follows.



Now if we do a long listing of the new link that was created we can see that it is a soflink by the way it gets listed



The first letter, l, in the long listing indicates that the file is a softlink and the last column indicates the file to which it is a softlink

The new link file is just a pointer to the original file and not a new copy of it and hence it occupies just enough space required for a link, which is very very small, rather than for the whole file.
The file can be opened and modified from either of the locations, and the changes will be reflected in files at both the locations.

No comments:

Post a Comment