How do I find all files containing a specific string of text within their file contents? The following doesn’t work. It seems to display every single file in the system. find / -type f -exec grep -H 'text-to-find-here' {} \;
Home/find
Do the following: grep -rnw '/path/to/somewhere/' -e 'pattern' -r or -R is recursive, -n is line number, and -w stands for match the whole word. -l (lower-case L) can be added to just give the file name of matching files. -e is the pattern used during the search Along with these, --exclude, --includRead more
Do the following:
-ror-Ris recursive,-nis line number, and-wstands for match the whole word.-l(lower-case L) can be added to just give the file name of matching files.-eis the pattern used during the searchAlong with these,
--exclude,--include,--exclude-dirflags could be used for efficient searching:--exclude-dirparameter. For example, this will exclude the dirsdir1/,dir2/and all of them matching*.dst/:This works very well for me, to achieve almost the same purpose like yours.
See less