Find the answer to your Linux question:
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.
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    2

    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
    total 141280
    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

  2. #2
    Linux User
    Join Date
    Dec 2009
    Posts
    264
    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.

    2. Hardlinks:
    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.

  3. #3
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •