Difference between a hard link and a symbolic link

Hard Link:

Soft Link:

How to create?

  • Original file that we want to “linked” : OriginalFile
  • File that will connect by a soft link: SoftLink file
  • File that will connect by a hard link: HardLink file

To create a hard link:

ln {OriginalFile} {HardLink file}

To create a soft link:

ln -s {Originalfile} {SoftLink file}

what is the difference?

Now you can see the real difference!

Now, let’s go to terminal and write an example!

first, we are creating our soft link & hard link file to the source file: prueba/saludos
First image:difference between hard link (hard-saludos) , soft link (soft-saludos), source file (saludos)
Second image: the content is the same!

Finally, let’s check the differences:

  • Types of files (first letter of the left column): Hard Link is a file (-), Soft Link (l) is a link
  • Also, we can check that soft link make a pointer ( — ->) to the source file “prueba/saludos”
  • We check that permissions are differents: Hard link file have the same permissions of the source file (saludos). But soft link change (it has the executive permission(x) for all! this is because, the “soft-saludos” is a pointer to “saludos”.
  • the size of files are differents: “hard-saludos” have the same size of “saludos” (case of hard-link). The size of “soft-saludos” is less than “saludos” (soft-link)

--

--

--

Software engineer in progress

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How Adopting Platforms as a Service (PaaS) Will Change Your Team

Espresso and Asynchronous jobs

https://medium.com/@sarahmiligan2005/https-app-bumiayu-id-trading-forex-apk-44bcfc2b5ffc

Getting started with ctags + Vim on MacOS

7 practical pandas tips when you start working with the library

Everything You Need To Know Before You Start Creating A Mobile App

Android vs iOS application. Source: https://pixelplex.io/blog/ios-vs-android-app-development/

Linux File System

LiteCoin Price Analyse 3rd of June

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Katherine Soto

Katherine Soto

Software engineer in progress

More from Medium

#01: Relational Model & Relational Algebra

Stack Data Structure: Definition, Implementation, and Applications in Javascript

Using store with Lit-elements

Chapter 16 Greedy Algorithms