tips:linux:findln
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | tips:linux:findln [2009/06/08 15:32] (current) – created erik | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How to identify and find Hardlinks? ====== | ||
+ | < | ||
+ | > ls -l | ||
+ | total 4 | ||
+ | -rw-r-r- | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | > ln test test2 | ||
+ | > ls -l | ||
+ | total 8 | ||
+ | -rw-r-r- | ||
+ | -rw-r-r- | ||
+ | </ | ||
+ | |||
+ | Notice field 2 changed from 1 to 2 indicating that a hard link has been created. There are now 2 filenames pointing to the same data. | ||
+ | |||
+ | To list all hardlinked files in the current directory: | ||
+ | |||
+ | < | ||
+ | > find . ! -type d -links +1 -ls | sort -n | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | To find all hardlink to the same inode: | ||
+ | |||
+ | < | ||
+ | > find / -xdev -inum 18587 | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | '' |
tips/linux/findln.txt · Last modified: 2009/06/08 15:32 by erik