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

To know the difference between a hard link and a symbolic link we have first to know the definitions of both terms.

what is a Hard Link?

a hard link is an additional name for an already existing file on an operating system. Hard Links can be created to other hard links however they can’t be created for directories. Since the original name of a file and it’s hard links all point to the same inode the operating system can’t distinct between the originally assigned name and any hard links.

What is an Inode ?

An inode have role of storing all information about a file except the name and the actual data, it’s a data structure on a file system on linux and other UNIX-like operating systems.

What Does Data Structure means ?

a Data structure is simply a way of storing information in a computer so that it can manipulate data quickly and with a minimum computer and network consumption.

What is a symbolic link?

symbolic links are shortcuts that points to a file, it references entries somewhere in the file . However, replacing the original file into a different folder will result a break in the symbolic link.

so what’s difference between a hard link and a symbolic link?

so the difference between a hard link and a symbolic link is that symbolic links have the ability to be linked to directories, or to files networked through Network File System on remote computers . Also, when deleting a target file, the symbolic links pointing to that file become unusable, On the other hand hard links preserve the contents of the file.