Your Absolute Guide to Hard link Vs Soft link in Linux

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

Hard link Vs Soft link

Table of contents

  1. Soft (Symbolic) link
    1. How to create Soft (Symbolic) link
    2. Example of Soft link
  2. Hard link
    1. How to create the Hard link
    2. Example of hard 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.

ln -s source_file symbolic_link
Here’s a way to create hard and soft links in Linux

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

ln orginal_file_path new_file_path

Related

Latest from the Blog

JCL MSGCLASS Vs. MSGLEVEL Top Differences

The MSGCLASS and MSGLEVEL control the print of messages to the output listing. Here are the detailed meanings and default values.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.