Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

ls -lai on a file gives me a link count of 2:

16508 -rw-rw-rw- 2 ...

Then looking for all the filenames returns only one:

find "$dir" -inum 16508

This lists only the original file, not two. What's wrong?

Also, if I am deleting files with this code:

find "$dir" -type f -links +1 -exec rm '{}' \;

how do I ensure that I don't delete the last filename (given that the link count seems incorrect in the above example)?

share|improve this question
up vote 1 down vote accepted

The problem was simply that the other filename resided outside of $dir. Running:

find / -inum 16508

found both filenames.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.