How to Find Hard Links Pointing to a Specific Inode in Ubuntu (find -inum)

The Hard Link Hunt

In Ubuntu Linux, a “hard link” is completely different from a standard symbolic link (shortcut). A hard link is literally a duplicate file name pointing directly to the exact same physical sector (the inode) on the hard drive. If you have a massive log file consuming 50GB of space, deleting the primary file will not free up the disk space if a hard link still exists somewhere else on the system pointing to that exact same inode. To successfully reclaim your storage, you must locate every single hard link associated with that specific physical data block.

Using the find Command with -inum

The Linux find command utilizes the -inum (inode number) flag to search the entire file system for files that share the exact same physical hard drive address.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. First, find the inode number of the file you want to investigate by typing ls -i /path/to/target_file (e.g., this might output 1345982).
  3. To scan the entire server for all hard links pointing to that specific inode, type the following command exactly:
  4. find / -inum 1345982
  5. Press Enter.

Targeted Deletion

The search engine will recursively dig through all subdirectories and output the absolute path of every single file name that shares that specific inode number. Because hard links cannot span across different disk partitions, you only need to run this command on the specific partition where the target file resides. Once you have the list of paths, you can safely delete all of them, guaranteeing that the operating system finally releases the locked data blocks and restores your available storage space.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.