[WayBack] linux – How can I find all hardlinked files on a filesystem? – Super User
use the following line (for sure you have to replace
/PATH/FOR/SEARCH/with whatever you want to search):find /PATH/FOR/SEARCH/ -xdev -printf '%i\t%n\t%p\n' | fgrep -f <(find . -xdev -printf '%i\n' | sort -n | uniq -d) | sort -nthis scans the filesystem only once, shows inode, number of hardlinks and path of files with more than one hardlink and sorts them according to the inode.
if you are annoyed by error messages for folders you aren’t allowed to read, you can expand the line to this:
find /PATH/FOR/SEARCH/ -xdev -printf '%i\t%n\t%p\n' 2> /dev/null | fgrep -f <(find . -xdev -printf '%i\n' 2> /dev/null | sort -n | uniq -d) | sort -n
It uses these commands:
–jeroen




