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

后端 未结 6 2113
遥遥无期
遥遥无期 2020-12-04 11:33

Consider the following command line snippet:

$ cd /tmp/
$ mkdir dirA
$ mkdir dirB
$ echo \"the contents of the \'original\' file\" > orig.file
$ ls -la o         


        
6条回答
  •  独厮守ぢ
    2020-12-04 11:46

    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"
    

提交回复
热议问题