Results 1 to 3 of 3
The man page for cp lists two ways to make a link: -l for a "link" and -s for a "symbolic link." The output from ls shows that there is ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 07-16-2010 #1
- Join Date
- Nov 2009
difference between a link and a symbolic link
The man page for cp lists two ways to make a link: -l for a "link" and -s for a "symbolic link." The output from ls shows that there is obviously a difference, but what is that difference?
$ cp -l /rd/note.txt ./.
$ cp -s /rd/note.txt ./note2.txt
$ ls -lt | head
lrwxrwxrwx 1 james james 12 2010-07-16 14:35 note2.txt -> /rd/note.txt
-rwxr--r-- 2 james family 77 2010-07-16 14:32 note.txt
- 07-16-2010 #2
- Join Date
- Dec 2009
As far I know there are two kind of links:
1. Symolik or soft-link:
Contains the path to a directory or file.
The position of the file can be anywhere.
Is integrated within the FS.
Meaning: theres a limit how many hardlinks are on one file.
The advantage of the hardlink is that it is like the file or directory gets shown in differnt locations ... if you delete the source file ... you will still be able to read the files from the other hardlinks.
The files realy get deleted after all hard-links are deleted.
As already mentioned it's integrated in the FS ... so you can only crate hard-links as long as it is on the same partition.
- 07-17-2010 #3
A hard link is a file name. When you create a file, its name is a hard
link. Additional hard links point to the same inode and are
equally valid names for the same file. A symbolic link has its own inode.
This is why a symbolic link can be on a different partition from the
file data, because it doesn't have to point to the file's inode, which it
could not do, being located on another file system.