Gentoo Archives: gentoo-user

From: Stefan Schulte <stefan.schulte@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How can I find all hard-links and soft-links?
Date: Wed, 03 Feb 2010 20:28:47
Message-Id: 20100203202754.GA5151@nebukadnezar.matrix.de
In Reply to: Re: [gentoo-user] How can I find all hard-links and soft-links? by Alan McKinnon
1 Yeah, you're right. And I think I have to correct myself. You don't have
2 two inodes, you have two directoryentries pointing to the same inode. So
3 if you want to find corresponding files, you can sort by inodenumber:
4
5 find /usr/bin -type f -links '+1' -print0 | xargs -0 ls -li | sort -n
6
7 On Wed, Feb 03, 2010 at 10:02:37PM +0200, Alan McKinnon wrote:
8 > On Wednesday 03 February 2010 21:43:31 Stefan Schulte wrote:
9 > > Hi Jarry,
10 > >
11 > > searching for softlinks is pretty easy:
12 > >
13 > > find / -type l
14 > >
15 > > If my understanding of hardlinks is correct you cannot say which file is
16 > > the original and which file is the link.
17 >
18 > It's worse than that - the concept of "original" and "the link" simply does
19 > not exist at all.
20 >
21 > Like invisible pink unicorns; you can't say "you can't see them so you can't
22 > say if it's there or not". The truth is "There are no invisible pink unicorns"
23 >
24 > > Both inodes just point to the
25 > > same datablocks. But you can identify those files by checking the
26 > > linkcount.
27 > >
28 > > find / -type f -links '+1'
29 > >
30 > > -Stefan
31 > >
32 > > On Wed, Feb 03, 2010 at 07:37:36PM +0100, Jarry wrote:
33 > > > Hi,
34 > > >
35 > > > just out of curiosity: is there any quick way to find all
36 > > > hard- and soft-links on a system? I just want to be sure
37 > > > they were all created after I moved system from the old disk
38 > > > to the new one...
39 > > >
40 > > > Jarry
41 > >
42 >
43 > --
44 > alan dot mckinnon at gmail dot com
45 >