Reputation: 81
I want to search a string in the directory (sub directories too) /www/mydirectory, the string is parcel. I have tried with the command grep -r "parcel". i got this from stackoverflow. But if i give this command, server is hanging up and displays nothing. Please help me in getting this.
Upvotes: 4
Views: 26102
Reputation: 71
Use this command
grep -nr "PARCEL" /var --color*
-n
for printing line number within the file
-r
searches recursively in sub-dirs as well
/var
is the top-level path from which the search is done recursively in all the sub-dirs & files
--color
highlights the grep'ed string in the output
Upvotes: 7
Reputation: 2276
Probably you see that server is hanging up because there are a lot of files and it need time to search required word or can't find it because required string doesn't exist
grep -r "parcel" /directory
is correct command to search string under given directory.
Upvotes: 2