I want to move a directory with a bunch of subdirectories and files. But I have the feeling there might be some symlinks to a few of them elsewhere on the file system. (As in the directory contains the targets of symlinks.)

How do I search all files for symlinks pointing to them?

Some combination of find, stat, ls, realpath, readlink and maybe xargs? I can’t quite figure it out.

  • bizdelnick@lemmy.ml
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    4 days ago

    find / -lname '/path/you/are/looking/for/*'

    Note that the -lname option is a GNU find extension and may not work with other find implementations.