|
ls -l | grep \> | grep "lr"
this does a long listing and greps on ">" which indicates a link. As an added filter, you can pipe that output to another grep "lr" which are the first two characters of the permissions string on a symbolic link. This will insure that you have only symbolic links in the output.
This will only work on the current directory, as piping 'find' to 'ls' doesn't work. To search subdirectories, try this series of commands:
-------------------------------------------------
shellprompt$ ls -l|grep "drw"|awk '{print "ls -l "$9" | grep \\> | grep \"lr\""}' > linksearch
shellprompt$ . linksearch
-----------------------------------------------
You could put the above in an executable script and run it from anywhere.
I'm sure there are even better ways to do this. find . -name "*" -l n will work so long as you know the exact number of links a given file has, and has the advantage of walking an entire hierarchy.
I hope this helps.
|