Skip to content

Instantly share code, notes, and snippets.

View jmuyden's full-sized avatar

Jorge Muyden jmuyden

View GitHub Profile
@jmuyden
jmuyden / find-string-in-files-linux.md
Last active September 25, 2022 16:59
Find string in files LINUX

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. Along with these, --exclude, --include, --exclude-dir flags could be used for efficient searching:

This will only search through those files which have .c or .h extensions: