Certifications / Open Source

Hard Links vs Soft Links in Linux: What’s the Difference?

Linux Hard Links versus Soft Links Explained picture: A
Follow us
Updated on September 9, 2025

Quick Definition: In Linux, a soft link (symbolic link) is like a shortcut that points to another file or directory, while a hard link is another filename that points directly to the same data on disk, so it still works even if the original is deleted.

One of the hardest parts of learning a new technology or tool is understanding its terminology—and the Linux operating system is no exception. Full of terms and phrases, learning to use the Linux OS is made even more challenging by the fact that some of its words are borrowed from other systems, while others apply only to Linux. 

Hard links and soft links are particular to Linux and other Unix-like OSs, and understanding them can help you navigate the filesystems of the Linux operating system. 

Want to learn more? Soft links, hard links, and other file types are covered in our Linux training module.

An Overview of Hard vs Soft Links [VIDEO]

In this video, Shawn Powers covers the difference between hard links and soft (or symbolic) links on a Linux OS 10 operating system. These are essentially two different ways that files are referenced on a hard drive, with the former pointing to the file itself and the latter directed towards the name of the file.

What are Linux Hard Links?

A hard link is another file that directly references the same data on disk as the original. Both files look and act separately but share the same data blocks. The key advantage: deleting the original doesn’t break the hard link—the data remains accessible.

How Do Hard Links Work?

Imagine a file (File 1) pointing to a specific location on the hard drive. When you create a hard link (File 2), it also points to that exact location. Open either file, and you’ll see the same data. Edit File 1, and File 2 changes too—because they both reference the same inode (the structure that stores file data).

Even though File 1 and File 2 may have different names and live in different directories, they’re tied to the same underlying data. That’s why hard links aren’t really “copies”—they’re just multiple paths to the same content.

What are Linux Soft Links?

A soft link (symbolic link) is a file that points to another file, similar to a Windows shortcut. Because it references the file name and not the data itself, soft links can point to directories or even remote files. The catch? If the original file is deleted, the soft link breaks.

How Do Soft Links Work?

Let’s say File 1 is the original. A soft link (File 3) doesn’t connect to File 1’s data on the hard drive—it only points to File 1’s name. That means the link takes up almost no space, no matter how large the original file is. A 5TB file linked with a soft link still only requires a tiny pointer file.

But there’s a catch: if File 1 is deleted, File 3 has nowhere to point and becomes useless. This is where soft links differ most sharply from hard links, which remain valid as long as the data exists on disk.

How are Hard Links and Soft Links Different?

Both soft links and hard links point to files, but there's a key difference between them. The difference comes down to what they're referencing: hard links refer to the actual data on the drive, while soft links only point to the file name.

Understanding the difference between a hard link and a soft link takes zooming in on a hard drive as far down as we can go. In Linux systems, the data structure that actually stores information is called an Inode. A hard link is simply another reference to the same data. If you change one, the other changes too. A soft link, on the other hand, only points to the file name, not the actual location of the data.

In short: 

  • Hard links reference the underlying data on disk (inode). Delete the original, and the data is still accessible through the hard link.

  • Soft links reference only the file name. Delete the original, and the link breaks.

How Do You Create Hard Links in Linux?

Now that we understand the differences, let's get into a tangible understanding of them. If you have access to a Linux command line, we'll walk through the commands for creating hard links and soft links. After we've created one of each, you'll probably see they're not terribly confusing. 

We will walk through a hypothetical file structure on our Ubuntu system. We start by opening up a terminal window and looking at the files in our directory:

ls

Now, we can imagine we have just one file in that directory: file1.txt. We can display the contents of it by typing:

cat file1.txt

This will show us the contents of file1.txt. In our hypothetical set-up, we've created a text file that reads, "This is a regular file."

First, we'll create a hard link to file1.txt. To do that, we'll use the "ln" command. It'll read "ln", followed by the source file ( file1.txt) and what we want to name the second, hard-linked file. We'll call it "hardlink.txt":

ln file1.txt hardlink.txt

When you hit enter, you'll get no feedback. But, type:

ls -l

This will show that there are now two files in the directory. The original file, file1.txt is still there. This readout indicates that it's 23 bytes. But we also have a new file that behaves and looks exactly like file1, but it's named hardlink.txt. It's also taking up 23 bytes. Why does it also have the exact same bytes? Because it's pointing to the same point on the hard drive.

Let's look at what "pointing to the same point on the hard drive" means in practice. Let's edit hardlink.txt by typing:

nano hardlink.txt

That will open hardlink.txt for editing, and we'll see that it still reads what file1.txt reads: "This is a regular file." The same file, the same data. We'll go into that text and edit it so that the file now reads, "This is a hardlinked file."

After we save it and close our editor, if we type:

cat file1.txt

We won't see the content of our original file1.txt. We'll see that the text has changed. Above, we saw that it read "This is a regular file." But now we changed the same file (file1.txt) and because we made a change to hardlink.txt, the data on the underlying hard drive changed. Now, both reference a chunk of text on the hard drive that says, "This is a hardlinked file".

If we delete file1.txt, our original file, we can still look at the contents of hardlink.txt. Because hardlink.txt is still pointing to the spot on the hard drive where the data is stored, deleting a different file that points to the same spot on the hard drive doesn't delete hardlink.txt.

To delete file1.txt, we'll type:

rm file1.txt

To see what this has done, we'll once again type:

ls

And now, in our directory, which previously held two files, there's just one: hardlink.txt.

How Do You Make Soft Links in Linux?

Still working in our hypothetical file directory, we'll now demonstrate how soft links function. It's always a good idea to start with a blank slate, so we'll type:

clear

With a blank screen, let's get a look at our directory and files in it by typing:

ls

Here, we see hardlink.txt. Now, to create a soft or symbolic link to that file, we'll use the same ln command we used earlier, but this time we'll add "-s" for soft (or symbolic). The syntax is otherwise the same, we specify our source file, which is now hardlink.txt, as we deleted file1.txt, and the name of the new file, which we'll call softlink.txt:

ln -s hardlink.txt softlink.txt

Again, we get no feedback here. But we can see the results of our copying by typing:

ls -l

In this view, we'll see something interesting. There are two entries. One for "hardlink.txt", and one for "softlink.txt -> hardlink.txt". This means that our original file, hardlink.txt, is still pointing to the hard drive at the location where the data is stored. However, softlink.txt isn't pointing at the hard drive. It's just pointing to the filename hardlink.txt.

Now, if we were to type:

cat softlink.txt

What would it show us? The contents of hardlink.txt. Because softlink.txt is soft linked to the file called hardlink.txt.

Soft links have different qualities and are smaller than hard links. But deleting what they point at creates problems. We can remove hardlink.txt by typing:

rm hardlink.txt

After removing hardlink.txt, let's look at what remains by typing:

ls -l

Not only is hardlink.txt missing, but we're getting red errors. The only return is from softlink.txt to hardlink.txt, but both are highlighted in red. That's the command line's way of telling us, "Okay, softlink.txt is pointing to the file called hardlink.txt, but that file doesn't exist. So something is broken". We can go even further by typing:

cat softlink.txt

We get told that there is "No such file or directory." This might seem confusing at first, because it's telling us that there's no such file or directory as "softlink.txt". But that means that softlink.txt is failing to point us to an existing file or directory.

And that's the central difference between a hard link and a soft link: since the soft link doesn't point to the hard drive location, it just points to a filename, we've lost that data.

Wrapping Up

Ultimately, the distinction between hard links and soft links is straightforward. Hard links are more forgiving when you delete a file; soft links take up less data because they just point the way. However, soft links don't store the actual data; they just store the location of the original file. Delete that, and you've lost the information.

If learning the skills necessary to navigate Linux storage and command lines is important to you, consider taking CBT Nuggets' Linux Essentials training.


DownloadUltimate Systems Administration Cert Guide

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.


Don't miss out!Get great content
delivered to your inbox.

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.

Recommended Articles

Get CBT Nuggets IT training news and resources

I have read and understood the privacy policy and am able to consent to it.

© 2025 CBT Nuggets. All rights reserved.Terms | Privacy Policy | Accessibility | Sitemap | 2850 Crescent Avenue, Eugene, OR 97408 | 541-284-5522