Want to Know: What Are Symbolic and Hard Links!?

Bre Rickner
2 min readSep 21, 2020

If you’re someone who came here wanting to learn about a shortcut in Linux a little bit more about links on Linux, great! Let me try to break things down a little! Let’s start by thinking of our links in UNIX, as a “pointer” to a file or directory. Creating a link is like creating a shortcut. The shortcut points us directly to the file/directory we want to access.

More specifically, there are TWO types of links that we can use!

HARD LINKS

SYMBOLIC LINKS (also known as ‘soft’ links)

The main difference in these two links is the action taken when the source file/directory that the link is pointing to has been moved or removed. I will discuss the specifics behind what each link does when the source file/directory has been moved/removed and cases in which we would use each link.

HARD LINK

A hard link always refers to the source even if it has been moved/removed. Hard links have the same Inode (identification number) value as the original, so it is referencing the physical location of the source. Hard links are often used because of their flexibility, however they cannot cross different filing systems.

Use the syntax below to create a hard link:

SYMBOLIC LINK

A symbolic/soft link is not updated if the source is moved/removed. When attempting to use a soft link, if the original source is removed, then the link will not work correctly, or become what is referred to as a “hanging link”. Each file is given a separate Inode (Identification number) than the original. As opposed to hard links, soft links can be used across different filing systems! Essentially, soft links use the path of the file instead of the content inside of the file.

To create a symbolic/soft link, use the syntax below:

Hopefully, after reading this, you were able to gain a better understanding of what symbolic and hard links do on a Linux system. Remember, the more you understand the basics, the easier it will be to utilize the full potential of the Shell! Also remember to be safe, know when you’re operating as root, and have fun! Until next time!

--

--

Bre Rickner

Fullstack Software Engineer — SDET — XR/AR/VR