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

I have a file system where one or more symlinks exist to a file. Is there a way to go thru each file and determine where all the symlinks that point to it on the file system are?

OS is Ubuntu 9.10 Linux

share|improve this question
Operating system? – DaveParillo Apr 21 '10 at 3:55
linux - ubuntu 9.10 to be exact – Roy Rico Apr 22 '10 at 15:41
up vote 3 down vote accepted

You can use good old find with the -lname switch:

find / -lname '/path/to/linked/file' 2> /dev/null

For a more intricate approach, you can use the inode number of the file (retrieve from ls -i <file>):

find / -follow -inum 123456 2> /dev/null
share|improve this answer
this has the limitation that it only matches a symlink with that exact filename (or pattern). it wouldn't catch a symlink to a symlink to that file. (so if symB points to fileA and symC points to symB, and you run this command looking for fileA, it'll find symB but not symC.) – quack quixote Apr 21 '10 at 4:05
True, but I'm just following the criteria he's given us. – John T Apr 21 '10 at 4:07
just sayin'. nice addition tho. :) – quack quixote Apr 21 '10 at 4:19

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.