Finding the Link, the Hard Link

Anthony David adavid at
Wed Mar 15 14:41:17 UTC 2006

On Wed, Mar 15, 2006 at 09:32:30AM -0500, David Walker wrote:
> OK, sorry for the sappy subject but oh well.
> So I am having a question and problem.  What I am doing is writing a 
> script to parse over 2 loop file systems, and check for changes.  
> Simple, no?  Well I thought so until I ran into the HardLink.  This 
> would be able to be ignored and just put 2 copies of the file in the 
> loop filesystem, however we are pressed for space and every 4k matters.  
> So I ask, is there a way to tell the difference between the real file, 
> and a hard link?

ls -li and/or stat command will give you the inode the stat command in
particular will tell you how many links to that file.

> eg.
> /etc/passwd and /etc/passwd.hl
> The .hl was made with ln, now how can I tell that it is, or was made 
> with ln, a hard link?
> --
> Dave

Anthony David

Gambling(n): A discretionary tax on those asleep during high school maths
0xA72CE1ED fingerprint = EA1E C69E FE59 BBE1 AA4B  F354 BD09 9765 A72C E1ED

More information about the ubuntu-users mailing list