|
|

02-03-2010, 05:37 PM
|
|
|
How can I find all hard-links and soft-links?
Hi,
just out of curiosity: is there any quick way to find all
hard- and soft-links on a system? I just want to be sure
they were all created after I moved system from the old disk
to the new one...
Jarry
--
__________________________________________________ _____________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.
|
|

02-03-2010, 06:16 PM
|
|
|
How can I find all hard-links and soft-links?
Jarry wrote:
> Hi,
>
> just out of curiosity: is there any quick way to find all
> hard- and soft-links on a system? I just want to be sure
> they were all created after I moved system from the old disk
> to the new one...
>
> Jarry
I think everything falls under the category of a hard or soft link. The
following commands may help.
This will print everything that has more than zero (one or more) links.
find / -links +0
This will print all symbolic links.
find / -type l
This should print all broken links from the current directory down:
notice no / or path.
find -L -type l
I would recommend testing these in /tmp or in a subdirectory first
before running them from /.
dhk
|
|

02-03-2010, 06:22 PM
|
|
|
How can I find all hard-links and soft-links?
On Wednesday 03 February 2010 20:37:36 Jarry wrote:
> Hi,
>
> just out of curiosity: is there any quick way to find all
> hard- and soft-links on a system? I just want to be sure
> they were all created after I moved system from the old disk
> to the new one...
Soft links are easy
app-misc/symlinks and/or "find / -type l" will do the job nicely.
Hard links are much harder to find. They are files, nothing more, nothing
less, so you have to examine the link count:
find / -type f -links +1 -ls
ought to do it. It will not tell you what else links to a given dentry, you
have to eyeball the entire jigsaw puzzle to piece that together. Sort the
output by file size, if you find 5 entries with a link count of 5 and the same
size and timestamps, they are probably all hardlinked to the same inode.
--
alan dot mckinnon at gmail dot com
|
|

02-03-2010, 06:43 PM
|
|
|
How can I find all hard-links and soft-links?
Hi Jarry,
searching for softlinks is pretty easy:
find / -type l
If my understanding of hardlinks is correct you cannot say which file is
the original and which file is the link. Both inodes just point to the
same datablocks. But you can identify those files by checking the
linkcount.
find / -type f -links '+1'
-Stefan
On Wed, Feb 03, 2010 at 07:37:36PM +0100, Jarry wrote:
> Hi,
>
> just out of curiosity: is there any quick way to find all
> hard- and soft-links on a system? I just want to be sure
> they were all created after I moved system from the old disk
> to the new one...
>
> Jarry
> --
> __________________________________________________ _____________
> This mailbox accepts e-mails only from selected mailing-lists!
> Everything else is considered to be spam and therefore deleted.
>
|
|

02-03-2010, 07:02 PM
|
|
|
How can I find all hard-links and soft-links?
On Wednesday 03 February 2010 21:43:31 Stefan Schulte wrote:
> Hi Jarry,
>
> searching for softlinks is pretty easy:
>
> find / -type l
>
> If my understanding of hardlinks is correct you cannot say which file is
> the original and which file is the link.
It's worse than that - the concept of "original" and "the link" simply does
not exist at all.
Like invisible pink unicorns; you can't say "you can't see them so you can't
say if it's there or not". The truth is "There are no invisible pink unicorns"
> Both inodes just point to the
> same datablocks. But you can identify those files by checking the
> linkcount.
>
> find / -type f -links '+1'
>
> -Stefan
>
> On Wed, Feb 03, 2010 at 07:37:36PM +0100, Jarry wrote:
> > Hi,
> >
> > just out of curiosity: is there any quick way to find all
> > hard- and soft-links on a system? I just want to be sure
> > they were all created after I moved system from the old disk
> > to the new one...
> >
> > Jarry
>
--
alan dot mckinnon at gmail dot com
|
|

02-03-2010, 07:27 PM
|
|
|
How can I find all hard-links and soft-links?
Yeah, you're right. And I think I have to correct myself. You don't have
two inodes, you have two directoryentries pointing to the same inode. So
if you want to find corresponding files, you can sort by inodenumber:
find /usr/bin -type f -links '+1' -print0 | xargs -0 ls -li | sort -n
On Wed, Feb 03, 2010 at 10:02:37PM +0200, Alan McKinnon wrote:
> On Wednesday 03 February 2010 21:43:31 Stefan Schulte wrote:
> > Hi Jarry,
> >
> > searching for softlinks is pretty easy:
> >
> > find / -type l
> >
> > If my understanding of hardlinks is correct you cannot say which file is
> > the original and which file is the link.
>
> It's worse than that - the concept of "original" and "the link" simply does
> not exist at all.
>
> Like invisible pink unicorns; you can't say "you can't see them so you can't
> say if it's there or not". The truth is "There are no invisible pink unicorns"
>
> > Both inodes just point to the
> > same datablocks. But you can identify those files by checking the
> > linkcount.
> >
> > find / -type f -links '+1'
> >
> > -Stefan
> >
> > On Wed, Feb 03, 2010 at 07:37:36PM +0100, Jarry wrote:
> > > Hi,
> > >
> > > just out of curiosity: is there any quick way to find all
> > > hard- and soft-links on a system? I just want to be sure
> > > they were all created after I moved system from the old disk
> > > to the new one...
> > >
> > > Jarry
> >
>
> --
> alan dot mckinnon at gmail dot com
>
|
|
|
All times are GMT. The time now is 10:00 AM.
VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org
|