Here are the differences between hard link and soft link in Linux. Below, you will find examples of how to create them.

Table of contents
Soft (Symbolic) link
lrwxrwxrwx 1 root root 11 2018-08-11 07:34 libc.so.6 -> libc-2.6.so
The beginning first letter ‘l’ says it is a link (symbolic). The soft link’s purpose is to use the same file in multiple places. That reduces your coding time.
For instance, a program needs a file named foo, but foo has frequent version changes. If we do not make it shared, it is hard to track down which version of the file is being used. In this scenario soft link I’d helpful.
Code to create soft link
ln -s source_file symbolic_link
Example of Soft link
Hard link
While we are on the subject of links, we need to mention that there is a second type of link called hard links. Hard links also allow files to have multiple names, but they do it differently.
Precisely, a hard link acts using a file with a different name. And the resource (source) is not sharable. It is the opposite in the case of symbolic link – That means the resource is sharable. to create the Hard link
Code to create hard link
ln orginal_file_path new_file_path
Example of hard link
Related







You must be logged in to post a comment.