≡ Menu

Advantage of using soft or hard links as compared to a copy of a file?

The question is – what is the advantage of using symbolic or hard links as compared to copying the file using the cp command?

The advantage of using links is that there is only one file present on the file system. The rest are just links to the file. If you copy the file using the cp command, you physically create a copy of the file on the disk. This wastes disk resources.

Another advantage of using links is that since there is only one copy of the file, changes are reflected on all links. So if you have a file and several links to the file,each change to the link will get reflected on all other links. This is the advantage of using a central copy of the file and then creating soft or hard links to the file.

Another use of creating links is that permissions reflect all links. If you change the permissions on the original file, the permissions will reflect on all links. Compare this to copies in which permissions need to be changed on all copies.

So use copies only if absolutely necessary. In all other cases, use symbolic or hard links.

For the difference between symbolic and hard links, see this article.

Incoming search terms:

  • advantage of soft file (1)
  • advantage of soft file and hard file (1)

Comments on this entry are closed.