How can I use find to search for symbolic links?

This is what I have:

abc:~/findtests$ ls -l  
total 0  
lrwxrwxrwx 1 abc abc 22 2010-11-30 14:32 link1 -> /home/abc/testpy1.py  

I am trying to search for the link link1 in the current directory.

I did :

abc:~/findtests$ find -L . -lname 'link1'
abc:~/findtests$ find -P . -lname 'link1'
abc:~/findtests$ find -L . -lname 'test*'
abc:~/findtests$ find -P . -lname 'test*'

But could not get any output. What am I doing wrong ?

Answers


To start with, from the man page:

"Using -L causes the -lname and -ilname predicates always to return false."

The target of the symbolic link doesn't match 'test*' because there is the full path. Try '*/test*'.


Need Your Help

Objective-C – Background threading with GCD and NSURLConnection

objective-c asynchronous nsurlconnection grand-central-dispatch

As I understand methods named *WithContentsOfURL: like [NSData dataWithContentsOfURL:] are synchronous.

ng-options and ng-bind not working with objects and strings

angularjs ng-options

I have a drop down bound to ng-options (which uses an array of objects)