I searched for log files on a server using find
, like this:
find . -name "*log*"
This didn't return anything useful, so I looked through some configuration files and discovered some log files in a subdirectory called build/private
.
If I pass that directory name directly to find
, it will discover those log files:
find ./build/private -name "*log*"
So it looks like find
is ignoring some subdirectories by default. Therefore, I'm not sure what other log files I'm missing.
I looked through find
's manual page but I didn't see any options that would force it to go through all subdirectories and look at all files.
Is there such an option?
Why does it not look through all subdirectories?
find
works with subdirectories just fine. Your name pattern does not match any files.
You might be better off using grep
for the pattern matching, for example, this will find all files with '.log' extention on the end, but not 'logchopper.py':
find . | grep '\.log$'