LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-14-2006, 09:42 PM   #1
RHLinuxGUY
Member
 
Registered: Oct 2003
Distribution: Ubuntu 7.04
Posts: 889
Blog Entries: 1

Rep: Reputation: 30
Is this how links (soft/hard) work?


Very quickly, this is how I understand hard/soft links(ln):

- Hard links point directly to the data of some file. Having it's own attributes (rwx etc.) and is indistinguishable from the original, because it is not pointing to the original file, it is pointing to the data the original file was pointing to. In another way to describe it, the linked file is just another name for the data. If you erase the file that the linked file original linked to, the data would still be there because the file you erase was not the last file that is using the data.


Code:
Ex:

  Original_File --> the_data

  Hard_Linked_File links to Original_File's data.. so..

  Hard_Linked_File --> the_data

- Soft links (or symbolic links, and symlinks), point directly to a file, which then that file points to the data it was assigned. Whatever attributes the original file posseses, passes it on to the other file that is soft linked to it. And unlike the hard link, if the source (or main) file is erased, the symlink file will contain no data(and will look red on some terminals).

Code:
Ex:  

  Original_File --> the_data

  Soft_Linked_File links to the Original_File.. so..

  Soft_Linked_File --> Original_File --> the_data
Am I correct? Apparently it is easier to point to file across different file systems using symlinks

Last edited by RHLinuxGUY; 10-14-2006 at 09:53 PM.
 
Old 10-14-2006, 10:06 PM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: Ubuntu, FreeBSD, NetBSD
Posts: 1,449

Rep: Reputation: 47
You are mostly right. It's an incremented reference for the hard links (which is another way of saying your first thing) and the second one is mostly right. Except that soft links are the ONLY way to link across mount points (filesystems). It's not that it's easier but hard links modify the inodes... which means they have to be local to that mount point.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
links (hard links and soft links..) sachitha Programming 1 08-10-2005 12:10 PM
Soft vs. Hard Links jrdioko Linux - Newbie 2 06-13-2004 02:41 PM
Hard/Soft Links nodger Linux - General 1 05-15-2004 10:36 AM
Soft Links tonphi Red Hat 1 09-22-2003 09:20 PM
Soft Links Resqtech Linux - Newbie 4 08-26-2001 10:00 AM


All times are GMT -5. The time now is 11:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration