Search for files containing a certain text, on my Synology, ignoring warnings like ‘ Permission denied’
Click to Read More
Just a note for myself… as I always forgot the syntax :/
Using grep only
grep -rnlw ‘/path/to/somewhere/’ -e ‘pattern’ 2>/dev/null
grep -rnlw ‘text’ ‘/path/to/somewhere/’ 2>/dev/null
-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.
Using find
find ‘/path/to/somewhere/’ -type f -exec grep “text” ‘{}’ \; -print
![]()
Leave a Reply