www.delorie.com/gnu/docs/findutils/find_13.html   search  
 
Buy GNU books!


Finding Files

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.2 Hard Links

To find hard links, first get the inode number of the file whose links you want to find. You can learn a file's inode number and the number of links to it by running `ls -i' or `find -ls'. If the file has more than one link, you can search for the other links by passing that inode number to `-inum'. Add the `-xdev' option if you are starting the search at a directory that has other filesystems mounted on it, such as `/usr' on many systems. Doing this saves needless searching, since hard links to a file must be on the same filesystem. See section 2.10 Filesystems.

Test: -inum n
File has inode number n.

You can also search for files that have a certain number of links, with `-links'. Directories normally have at least two hard links; their `.' entry is the second one. If they have subdirectories, each of those also has a hard link called `..' to its parent directory.

Test: -links n
File has n hard links.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003