Tip #743 Grep for word in directory
I've often seen people using the find command on a directory to get all the files, then using these with grep to find files containing a particular word. This can however, be done better just using grep:grep --color=auto -inHR "search_for" /in/dir
greps for occurances of 'search_for' in the specified directory and below, or the current directory if none specified.
Options:
-i case insensitive
-n shows line number
-H shows file name
-R recursive
- TAGS:
- grep
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs