Daniel Lorenzo Scoccia
2 min readJun 10, 2020

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

Hard Link Definition:

A hard link is merely an additional name for an existing file on Linux or other Unix-like operating systems.

Any number of hard links, and thus any number of names, can be created for any file. Hard links can also be created to other hard links. However, they cannot be created for directories, and they cannot cross filesystem boundaries or span across partitions.

Perhaps the most useful application for hard links is to allow files, programs, and scripts (i.e. short programs) to be easily accessed in a different directory from the original file or executable file (i.e., the ready-to-run version of a program). Typing the name of the hard link will cause the program or script to be executed in the same way as using its original name.

Mean while, Soft links is a special kind of file that points to another file, much like a shortcut. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system. This difference gives symbolic links certain qualities that hard links do not have, such as the ability to link to directories, or to files on remote computers networked through NFS. Also, when you delete a target file, symbolic links to that file become unusable, whereas hard links preserve the contents of the file.

what are the differences between hard and soft links?

A soft link does not contain the data in the target file.

A soft link points to another entry somewhere in the file system.

A soft link has the ability to link to directories, or to files on remote computers networked through NFS.

Deleting a target file for a symbolic link makes that link useless.

A hard link preserves the contents of the file.

A hard link cannot be created for directories, and they cannot cross filesystem boundaries or span across partitions.

In a hardlink you can use any of the hardlink names created to execute a program or script in the same manner as the original name given.

Daniel Lorenzo Scoccia
Daniel Lorenzo Scoccia

Written by Daniel Lorenzo Scoccia

0 Followers

Full Stack Software Developer. Freelancer.

No responses yet