You are on page 1of 5

Skip to content <#content>

2daygeek.com <https://www.2daygeek.com/>

*
Search for:

* Shell Script <https://www.2daygeek.com/category/shell-script/>


* Linux Distro’s <https://www.2daygeek.com/category/linux-distributions/>
* Linux Commands <https://www.2daygeek.com/category/linux-commands/>
* Web Servers <https://www.2daygeek.com/category/webserver/>
* Monitoring Tools <https://www.2daygeek.com/category/monitoring-tools/>
* Package Manager <https://www.2daygeek.com/category/package-management/>
* Additional Repos <https://www.2daygeek.com/category/repository/>
* Cloud Storage <https://www.2daygeek.com/category/free-cloud-storage/>

// //

* Home <https://www.2daygeek.com/>
* Linux Tech News <https://linuxtechnews.com/>
* About <https://www.2daygeek.com/about-us/>
* Privacy Policy <https://www.2daygeek.com/privacy-policy/>
* Terms And Conditions <https://www.2daygeek.com/terms-and-conditions/>
* Donate <https://www.2daygeek.com/donate/>
* Join Us <https://www.2daygeek.com/join-us/>
* Contact Us <https://www.2daygeek.com/contact-us/>
* OS Tweak <https://www.2daygeek.com/category/os-tweaks/>
* Icons <https://www.2daygeek.com/category/icon-theme/>
* Themes <https://www.2daygeek.com/category/gtk-theme/>

//

Search for:

2daygeek.com <https://www.2daygeek.com/>

* Shell Script <https://www.2daygeek.com/category/shell-script/>


* Linux Distro’s <https://www.2daygeek.com/category/linux-distributions/>
* Linux Commands <https://www.2daygeek.com/category/linux-commands/>
* Web Servers <https://www.2daygeek.com/category/webserver/>
* Monitoring Tools <https://www.2daygeek.com/category/monitoring-tools/>
* Package Manager <https://www.2daygeek.com/category/package-management/>
* Additional Repos <https://www.2daygeek.com/category/repository/>
* Cloud Storage <https://www.2daygeek.com/category/free-cloud-storage/>

* Uncategorized <https://www.2daygeek.com/category/uncategorized/>

What is the Difference Between Soft link vs Hard link in Linux?

by Magesh Maruthamuthu <https://www.2daygeek.com/author/magesh/> · Last


Updated: May 28, 2020

A link is a mechanism for creating a shortcut to the original file or


directory. It contains information about another file or directory.

Links allow more than one filename to reference the same file.
What’s Soft link

A symbolic link, also known as a symlink or a soft link, is a special


type of file that points to another file or directory on Linux.

It’s like a shortcut in Windows. It contains the path of the original


file and not the contents.

In general Symbolic links are used to link libraries. Also, used to link
log files and folders on mounted NFS (Network File System) shares.

What’s Hard link

Hard link is a mirror copy of the original file. Deleting the original
file does not impact anything, because the hard link file serves as a
mirror copy of the original file.

Why would you want to create a link file instead of copying them?

This is especially useful when you want to keep a same files in multiple
location with updated contents.

When you copy a file to another location, it will copy the content and
never get updated from the source file.

The contents of the file will be different from time to time.

The difference between Soft link vs Hard link

I’ve included possible difference between soft link and hard link in the
table below.

S.No Soft Link Hard Link


1 The soft link is similar to the file shortcut on Windows. Hard link is
a mirror copy of the original file.
2 Soft link can be called Symbolic link or symlink. Hard link has no
other name
3 Changes in both file are reflected in the other. It's like a soft link.
4 Soft links can be created on different file systems. Hard link can
only be made on the same file system.
5 Can create a soft link to files and directories Only files can be linked
6 It has different inode number and file permissions compared to the
original file. It has the same inode number and file permissions.
7 It contains the path of the original file and not the contents. It
contains the actual contents of the original file.
8 When the original file is removed, the link will die because it points
to a non-existent file. This is called the hanging link. Nothing happens
when the original file is removed.
9 You can create a soft link with the following command (# ln -s [Source
Filename] [Link Name]) Hard link can be created using the following
command (# ln [Source Filename] [Link Name])
10 The soft link file contains a special symbol "l" in the file
permission field. There is no special symbol for this.
11 You can find the soft link file with the following command (# find /
-type l) You can find the hard link file with the following command (#
find / -samefile [Source Filename])
12 A broken soft link can be found using the following command (#
symlinks [Path/to/Directory]). Not applicable

Share this:

* Facebook
<https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/?
share=facebook&nb=1>
* LinkedIn
<https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/?
share=linkedin&nb=1>
* Twitter
<https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/?
share=twitter&nb=1>
* Tumblr
<https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/?
share=tumblr&nb=1>
* Pinterest
<https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/?
share=pinterest&nb=1>
* Pocket
<https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/?
share=pocket&nb=1>
*

Tags: Hard link <https://www.2daygeek.com/tag/hard-link/>Link


<https://www.2daygeek.com/tag/link/>Linux
<https://www.2daygeek.com/tag/linux/>Soft link
<https://www.2daygeek.com/tag/soft-link/>Symbolic link
<https://www.2daygeek.com/tag/symbolic-link/>Symlink
<https://www.2daygeek.com/tag/symlink/>

Magesh Maruthamuthu

Love to play with all Linux distribution

*
*
/

/
*Previous story

* How to Remove Files Older than N Days Using Tmpwatch/Tmpreaper on


Linux
<https://www.2daygeek.com/how-to-remove-files-older-than-n-days-using-tmpwatch-
tmpreaper-on-linux/>

//You may also like...

*
<https://www.2daygeek.com/translate-shell-a-tool-to-use-google-translate-from-
command-line-in-linux/>

Translate Shell – A tool to use Google translator from


command line in Linux
<https://www.2daygeek.com/translate-shell-a-tool-to-use-google-
translate-from-command-line-in-linux/>

November 30, 2017

*
<https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-
anyone-in-seconds/>

tmate – To share your terminal session instantly with anyone


in few seconds.
<https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-
to-anyone-in-seconds/>

November 28, 2017

*
<https://www.2daygeek.com/portainer-a-simple-docker-management-gui/>

Portainer – A simple Docker management GUI


<https://www.2daygeek.com/portainer-a-simple-docker-management-gui/>

December 6, 2017

//

Follow:

* // <https://www.facebook.com/2daygeek>
* // <https://www.twitter.com/2daygeek>
* // <https://www.linkedin.com/company/2daygeek>
* // <javascript:void(0)>
* // <http://2daygeek.tumblr.com/>

Linux & Open Source News

<https://www.linuxtechnews.com/>

– Click Here To Get Offers –

Ethical Hacking Course

<https://ethicalhackersacademy.com/?ref=400ewqahhx>

– For Better Offers –

To Search, Type and Hit Enter


× <javascript:void(0)>

search

Custom Search
Sort by:
Relevance
Relevance
Date

Google Translater

Powered by Google TranslateTranslate <https://translate.google.com/>

Linux Online Course

<https://stacksocial.com/sales/complete-linux-crash-course-includes-topics-on-red-
hat-unix-kali-python-and-opensuse?aid=a-4s5jc8po>
// <#>

2daygeek <https://www.2daygeek.com/> :- Linux Tips & Tricks, Linux


How-to Guides & Tutorials is licensed under a (cc) BY-NC
<https://creativecommons.org/licenses/by-nc/4.0/>

* // <https://www.facebook.com/2daygeek>
* // <https://www.twitter.com/2daygeek>
* // <https://www.linkedin.com/company/2daygeek>
* // <javascript:void(0)>
* // <http://2daygeek.tumblr.com/>

Google Translate

Original text

Contribute a better translation


------------------------------------------------------------------------
Cookies help us deliver our services. By using our services, you agree
to our use of cookies.Learn more <https://www.2daygeek.com/about-us/>Got
it <#>
<#>

You might also like