I know there are ways to figure out actual physical location of a file by following the symbolic link. But is it possible to know where is the symbolic link if you know the physical location of the file and you are sure that there is a symbolic link.
Asked
Active
Viewed 9,177 times
3 Answers
2
Well, yes, but you must traverse all mounted file systems with find(1)
in order to locate any links.

Community
- 1
- 1

DigitalRoss
- 143,651
- 25
- 248
- 329
1
ls -l
Doesn't show it? It should, otherwise look at the manual.
Edit:
Take a look at this thread: Linux: Find all symlinks of a given 'original' file? (reverse 'readlink')
-
Thanks a lot for quick reply. It works if we know where the symbolic link is located in the file system. In my case i know the file location but I have lost its symbolic link. I wanted to know the easiest way to find it. – jojo.math Jul 12 '12 at 15:42
-
1
The filesystem simply does not contain that information, to the best of my knowledge. That means your only way is to traverse the filesystem looking at all the symlinks and marking those that point to your desired file.
Not ideal, I know. The symlinks tool (apt-get install symlinks) will help you do this. Be careful, it doesn't traverse filesystem boundaries!

Miquel
- 15,405
- 8
- 54
- 87
-
1If the tool's useful, great! But check out @DigitalRoss answer, the link he provides proposes `find -L /dir/to/start -samefile /tmp/orig.file` which does the trick and will run on any computer (since it doesn't depend on specific software) – Miquel Jul 12 '12 at 15:52
-