You can translate the content of this page by selecting a language in the select box.
How to search all files containing a specific string on Linux and Windows?
-
On Linux
grep -rnw ‘directory’ -e “pattern”
grep –include=\*.{txt,log} -rnw ‘directory’ -e “pattern”
This will only search for files with .txt or .log extension.
grep –exclude=*.txt -rnw ‘directory’ -e “pattern”
This will exclude files with .txt extensions.
-
On Windows
CD Location
FINDSTR /L /S /I /N /C:”pattern” *.log