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

Reply via email to