What is the difference between a hard link and a symbolic link?

Milena Molina Montoya
3 min readJun 13, 2020

--

Hello everyone, today is the turn of the links.
Which are hard and symbolic links.
If you are reading this, it is because you are already entering the world of Linux and its great advantages.

Well let’s get down , when we start working with any Linux distribution, terminal or shell we must know certain shortcuts to make our way easier.

What is a Symbolic link?

These are similar to the shortcuts we see in Windows, each symbolic link has its own inode number and is different from the original file. These links point to the name of a file and then to the content of our hard drive

Symbolic links can be created with files and directories, these are created as follows

Image 1

First we create a text file, this is done with the touch command Filename.txt … (.txt) is the extension for text files.

After creating the file we execute the following command ls -li to list all the files and verify that our file is.

image 3

With the file ready we create a symbolic link to the file that we end up executing the following command in the terminal:
ln -s /home/mimol/Symbolic_Link.txt / mnt / d / Downloads / linkS

We execute the following command ls -li / mnt / d / Downloads / linkS to verify that the link has been created.

Hard Links

They are faithful copies of the file.

the first pason are the same as the previous one.
we create a file with .txt extension

touch Hard_Link.txt

we list with ls -li Hard_Link.txt

confirmed the file we create a hard link to the file that we just made by entering the following command in the terminal:

Hard_Link.txt linkH

This would be our links created ln -s for symbolic links, ln for hard links

--

--