User Tools

Site Tools


bash:files:difference_between_a_copy_of_a_file_and_a_hard_link

BASH - Files - Difference between a copy of a file and a hard link

ItemNumber of FilesEdit the FileDelete the FileDisk Space Used
copy2 filesThe other file is unchanged.The other file remains.Twice as much disk space used (two different files)
hard link1 fileThe other file is also edited.The other file remains.Only one file on disk.
soft link1 file + 1 linkThe other file is also edited.If you delete the file the link is broken.
If you remove the link the file stays in place.Only one file on disk.

copy:

  • There will be two different versions of the file.
  • if you edit one, the other one stays the same.
  • if you delete one, the other one stays there, but it may not be identical if it was edited.
  • Twice as much disk space used (two different files).

hard link:

  • There will be one file with two different filenames.
  • If you edit one, it gets edited in all filename locations.
  • if you delete one, it still exists in other places.
  • Only one file on disk.

soft link:

  • There is one file with one filename and a pointer to that file with the other filename.
  • if you edit the link its really editing the original file.
  • if you delete the file the link is broken.
  • if you remove the link the file stays in place.
  • Only one file on disk.
bash/files/difference_between_a_copy_of_a_file_and_a_hard_link.txt · Last modified: 2022/06/13 10:42 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki