[ale] link

Jeff Lightner jlightner at water.com
Wed Apr 11 12:52:24 EDT 2007


When you create a (hard) link you're using the same inode as the
original file so you're creating a separate name only.   This requires
it to be on the same filesystem as the original.

When you erase (rm) you are just removing the name so the other name is
still there.   The only thing that changes is the link count.  To remove
the file you have to remove all link "names".  

Although inode is the same the space taken up by a hard link is the same
as that of a copy.   The benefit to link over copy is that changes to
any of the links to the file are reflected in all of the links.   In a
copy the change you make to one copy does NOT get reflected in any of
the other copies until you recopy the original file again.

To save the space noted above you can use "ln -s" which creates a
symbolic link.   The symbolic link uses only enough space for the
pointer and name and has the added benefit that since it doesn't use the
same inode it doesn't have to be on the same filesystem.

So the question becomes what are you trying to do?:
If you want to have shortcuts to the same file in multiple locations
then ln is the way to go.
If you want to have backup copies of a file then cp is the way to go.
If you need links across filesystem or are concerned about space then
"ln -s" is the way to go.



-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
To: ale at ale.org
Terry Bailey
Sent: Wednesday, April 11, 2007 12:44 PM
To: ale at ale.org
Subject: [ale] link

Hi,

If you do a

ln file1.abc file2.xyz

is there a way to erase one and they both go away?

Also, it shows that they both are the same size. Is it the case that 
there is only one instance of the data.

If this is not the case, then you might as well do cp file1.abc
file2.xyz

In addition, which is quicker

ln file1.abc file2.xyz    or      cp file1.abc file2.xyz

Thanks,

Terry Bailey

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list