title: Linux: Find all symlinks of a given 'original' file? (reverse 'readlink')
body: <p>Consider the following command line snippet: </p>
  
  <pre><code>$ cd /tmp/
  $ mkdir dirA
  $ mkdir dirB
  $ echo "the contents of the 'original' file" &gt; orig.file
  $ ls -la orig.file 
  -rw-r--r-- 1 $USER $USER 36 2010-12-26 00:57 orig.file
  
  # create symlinks in dirA and dirB that point to /tmp/orig.file:
  
  $ ln -s $(pwd)/orig.file $(pwd)/dirA/
  $ ln -s $(pwd)/orig.file $(pwd)/dirB/lorig.file
  $ ls -la dirA/ dirB/
  dirA/:
  total 44
  drwxr-xr-x  2 $USER $USER  4096 2010-12-26 00:57 .
  drwxrwxrwt 20 root          root          36864 2010-12-26 00:57 ..
  lrwxrwxrwx  1 $USER $USER    14 2010-12-26 00:57 orig.file -&gt; /tmp/orig.file
  
  dirB/:
  total 44
  drwxr-xr-x  2 $USER $USER  4096 2010-12-26 00:58 .
  drwxrwxrwt 20 root          root          36864 2010-12-26 00:57 ..
  lrwxrwxrwx  1 $USER $USER    14 2010-12-26 00:58 lorig.file -&gt; /tmp/orig.file
  </code></pre>
  
  <p>At this point, I can use <code>readlink</code> to see what is the 'original' (well, I guess the usual term here is either 'target' or 'source', but those in my mind can be opposite concepts as well, so I'll just call it 'original') file of the symlinks, i.e.</p>
  
  <pre><code>$ readlink -f dirA/orig.file 
  /tmp/orig.file
  $ readlink -f dirB/lorig.file 
  /tmp/orig.file
  </code></pre>
  
  <p>... However, what I'd like to know is - is there a command I could run on the 'original' file, and find all the symlinks that point to it? In other words, something like (pseudo):</p>
  
  <pre><code>$ getsymlinks /tmp/orig.file
  /tmp/dirA/orig.file 
  /tmp/dirB/lorig.file
  </code></pre>
  
  <p>Thanks in advance for any comments, </p>
  
  <p>Cheers!</p>