I had created many symbolic links on various paths for a particular file or a directory. I want the whole list of created symbolic links paths (location).
Example:
I created symbolic links for ~/Pictures
directory on many directories. How do I list all the symlinks to that ~/Pictures
directory?
Is that possible? If yes, then how?
Here is an example:
or, maybe better:
to get rid of some errors like
Permission denied
,Too many levels of symbolic links
, orFile system loop detected
whichfind
throws them when doesn't have the right permissions or other situations.-L
- Follow symbolic links.-xtype l
- File is symbolic link-samefile name
- File refers to the same inode asname
. When-L
is in effect, this can include symbolic links.Notes:
-xtype l
, not the digit 1.-xtype
is-type
.Very simple, use option
-lname
:From
man find
:Note: Remember that symbolic links could be anywhere, which includes a remote system (if you’re sharing files), so you may not be able to locate them all.
Try this :
find . -follow -inum 277566
( find directories with the same inode number )It will display all its symbolic links paths .
I like this one-liner the most:
find . -maxdepth 1 -type l -exec readlink -f '{}' \;
refs:
https://unix.stackexchange.com/questions/22128/how-to-get-full-path-of-original-file-of-a-soft-symbolic-link
https://unix.stackexchange.com/questions/21984/list-symlinks-in-current-directory