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