Re: Finding hard links
On Tue, Oct 17, 2006 at 04:45:05PM -0400, T wrote:
> Hi
>
> How can I find hard linked files?
All "regular" files are hard links. See
<http://en.wikipedia.org/wiki/Hard_link>
the stat(1) command tells you how many files point at a
given inode (so, if "Links:" > 1, you have two filenames and
one file):
$ touch a
$ ln a b
$ stat a
File: `a'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fe01h/65025d Inode: 1287087 Links: 2
Access: (0644/-rw-r--r--) Uid: ( 1000/ jon) Gid: ( 1000/ jon)
Access: 2006-10-17 22:47:53.000000000 +0100
Modify: 2006-10-17 22:47:53.000000000 +0100
Change: 2006-10-17 22:47:54.000000000 +0100
> Is it possible to find the hard links of the same file?
> Ie, group the above finding into same file groups?
Parse the above (if you are writing a shellscript) or use
the equivalent system call in C: stat(2)
--
Jon Dowland
Reply to: