Hard and Symbolic Links

 PREAMBLE

Tutorial expresses the author's subjective ideas and conform to AAL license.



Description

Used to make a "hologram" of a existing file or directory.



Intro

First of all, let's move to the /tmp directory and make a text file

$ echo "this is simple text file" > simt.txt

$ cat simt.txt

$ ls -lh simt.txt



Next Level

Now, create a hardlink

$ ln simt.txt hardlink.txt

$ ls -l

You can remark that simt.txt and hardlink.txt have same size, same last modified time, same access permissions and so on because it's linked to same space on the harddisk. To prove that, just edit original file.

$ echo -e "\n hard or not so hard" >> simt.txt

$ cat simt.txt

$ cat hardlink.txt

Good to mention the fact: If one of the file is deleted, second remains

$ rm simt.txt

$ ls

$ cat hardlink.txt


OK, let's talk now about symbolic links because they act somehow other way

$ ln -s hardlink.txt softlink.txt

$ ls -l

In case of symbolic links, if you delete source file, link is useless because it can not point to inexistent location

$ rm hardlink.txt

$ ls -l



Last thoughts

Be shure that I will update tutorial in the future. So, stay on tune. And, in case it was useful, share please with your fellows or comment something regarded the subject.

For donations use that link.

Comments