leungpingkei
asked on
How to find a word in all files under / ?
Dear all expert,
How can I find a word in all files under / ? Please be informed that it contains files or folders under / so "more /* | grep (word)" is not workable.
Thanks
Gary
How can I find a word in all files under / ? Please be informed that it contains files or folders under / so "more /* | grep (word)" is not workable.
Thanks
Gary
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
grep -l will give the file name instead of the matched lines.
ASKER
Thanks for all your information.
grep -r word /*
Otherwise use find:
find / -type f | xargs grep word
If you don't have xargs, use find -exec
find / -type f -exec grep word {} \;