3

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.

1
  • With many shells, you need to escape the asterisk, e.g. find . -name lib\* Oct 22, 2012 at 16:01

2 Answers 2

3

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

4
  • This is the case. The asterisk is being expanded before it is passed to find as an argument.
    – Will
    Oct 22, 2012 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, 2012 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." Oct 22, 2012 at 18:30
  • When I need to search with a *, I enclose it in "" and it works. find . -name "lib*" Oct 22, 2012 at 19:13
2

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

> sudo find / -name "*.so"  

will return all the .so of my system.

You must log in to answer this question.