Linux: Find all symlinks of a given 'original' file? (reverse 'readlink')

Using GNU find, this will find the files that are hard linked or symlinked to a file:

find -L /dir/to/start -samefile /tmp/orig.file

I've not seen a command for this and it's not an easy task, since the target file contains zero information on what source files point to it.

This is similar to "hard" links but at least those are always on the same file system so you can do a find -inode to list them. Soft links are more problematic since they can cross file systems.

I think what you're going to have to do is basically perform an ls -al on every file in your entire hierarchy and use grep to search for -> /path/to/target/file.

For example, here's one I ran on my system (formatted for readability - those last two lines are actually on one line in the real output):

pax$ find / -exec ls -ald {} ';' 2>/dev/null | grep '\-> /usr/share/applications'
lrwxrwxrwx 1 pax pax 23 2010-06-12 14:56 /home/pax/applications_usr_share
                                         -> /usr/share/applications

Inspired by Gordon Davisson's comment. This is similar to another answer, but I got the desired results using exec. I needed something that could find symbolic links without knowing where the original file was located.

find / -type l -exec ls -al {} \; | grep -i "all_or_part_of_original_name"