Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For some reason "find" doesn't locate .so files unless they're in the same directory I'm in. For example:

r-mbp:~ todd.r$ cd /usr/local/apache/modules/
r-mbp:modules todd.r$ ls
httpd.exp   libphp5.so
r-mbp:modules todd.r$ find . -name lib*
./libphp5.so
r-mbp:modules todd.r$ cd ..
r-mbp:apache todd.r$ find . -name lib*
./include/php/ext/date/lib
./lib
r-mbp:apache todd.r$

Any ideas? I'm looking for another instance of libphp5.so, but without being able to search from "/", I'm a bit stuck.

share|improve this question

migrated from stackoverflow.com Oct 22 '12 at 17:57

This question came from our site for professional and enthusiast programmers.

    
With many shells, you need to escape the asterisk, e.g. find . -name lib\* –  Joseph Quinsey Oct 22 '12 at 16:01
add comment

2 Answers 2

up vote 3 down vote accepted

I don't know OSX, but with many shells, you need to escape the asterisk, e.g. find . -name lib\*.

share|improve this answer
    
This is the case. The asterisk is being expanded before it is passed to find as an argument. –  Will Oct 22 '12 at 16:22
    
This answer is correct. I'll add you'd probably get better results if you'd run something like find -x / -type f -name libphp5.so. Across your whole computer, many files and directories are likely to be called lib*. –  Yaniv Aknin Oct 22 '12 at 16:25
    
yes - bash(1) also lists the order, because there is more than one expansion :-) "The order of expansions is: brace expansion, tilde expansion, parameter, variable and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and pathname expansion." –  Florenz Kley Oct 22 '12 at 18:30
    
When I need to search with a *, I enclose it in "" and it works. find . -name "lib*" –  UtahJarhead Oct 22 '12 at 19:13
add comment

Give a try with double quote and/or sudo-ing :

> sudo find / -name "*.so"  

will return all the .so of my system.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.