Using find
with grep
, one can locate files that match a pattern:
# find | grep error
./solr-modifiedSolr4/SolrPhpClient/phpdocs/errors.html
./error_log
./includes/classes/error_log
However, using find
alone the first file is not found:
# find . -name error*
./error_log
./includes/classes/error_log
Why doesn't find
locate the errors.html
file when not used with grep
? How is find
used to show this file as well?
find -name error\*
- one key less to press ;) this has the same effect, the*
gets passed as an literate asterisk to the find command and is not expanded by your shell – zhenech Nov 11 '12 at 11:14echo
command. So, if you'd runecho find . -name error*
it would have outputtedfind . -name error_log
– Carlos Campderrós Nov 12 '12 at 10:01