GREP(1) GREP(1) (NAME) grep, egrep, fgrep, rgrep - (SYNOPSIS) grep [...] [...] grep [...] -e ... [...] grep [...] -f _ ... [...] (DESCRIPTION) grep . (newline) grep . grep () . "-" (standard input) . . egrep fgrep rgrep . grep -E grep -F grep -r . (deprecated) . grep . (OPTIONS) (Generic Program Information) --help . -V, --version grep . (Pattern Syntax) -E, --extended-regexp (EREs). -F, --fixed-strings . -G, --basic-regexp (BREs). . -P, --perl-regexp (PCREs). -z (--null-data) grep -P . (Matching Control) -e , --regexp= . -f (--file) . "-" . -f , --file= . -e (--regexp) . . - . -i, --ignore-case . --no-ignore-case . . -i . -v, --invert-match . -w, --word-regexp . (_) . -x . -x, --line-regexp . (General Output Control) -c, --count . -v, --invert-match . --color[=], --colour[=] . GREP_COLORS . never always auto . -L, --files-without-match . -l, --files-with-matches . . -m , --max-count= . . - . -o, --only-matching ( ) . -q, --quiet, --silent . () . -s . -s, --no-messages . (Output Line Prefix Control) -b, --byte-offset ( ) . -H, --with-filename . . -h, --no-filename . ( ) . --label= . : gzip -cd foo.gz | grep --label=foo -H 'some pattern'. -n, --line-number ( ) . -T, --initial-tab Tab . -Z, --null ( ASCII NUL) ( newline). xargs -0 . (Context Line Control) -A , --after-context= . (--) . -B , --before-context= . -C , -, --context= ( ). --group-separator= -A -B -C -- . --no-group-separator . (File and Directory Selection) -a, --text () --binary-files=text. --binary-files= . binary grep . without-match ( -I). text . -D , --devices= (device) FIFO : read ( ) skip ( ). -d , --directories= : read () skip ( ) recurse ( -r). --exclude= wildcard . --exclude-from= . --exclude-dir= . -I --binary-files=without-match. --include= . -r, --recursive . . -R, --dereference-recursive ( -r). (Other Options) --line-buffered ( ). -U, --binary ( MS-DOS MS-Windows CR/LF). -z, --null-data (ASCII NUL) . (REGULAR EXPRESSIONS) . . grep : (BRE) (ERE) (PCRE). grep . . . () (\) . (.) . (Character Classes) [ ] . ^ . [0123456789] . ( [a-z]). [:alnum:] [:alpha:] [:digit:] [:lower:] [:upper:] [:space:] . (Anchoring) / (^) ($) . (Repetition) ? . * . + . {n} n . {n,} n . {,m} m ( ). {n,m} n m . (Concatenation and Alternation) . | . (Back-references) \n n . (EXIT STATUS) . -q . (ENVIRONMENT) GREP_COLORS . LC_ALL, LC_COLLATE, LANG . LC_ALL, LC_CTYPE, LANG ( UTF-8 ASCII) . LC_ALL, LC_MESSAGES, LANG . POSIXLY_CORRECT grep POSIX . (NOTES) . (COPYRIGHT) 1998-2000, 2002, 2005-2023 (Free Software Foundation, Inc.) . . (BUGS) . (EXAMPLE) "f" ".c" "g" ".h" : $ grep -n -- 'f.*\.c$' *g*.h /dev/null (SEE ALSO) awk(1), cmp(1), diff(1), find(1), perl(1), sed(1), sort(1), xargs(1), read(2), pcre2(3), regex(7) GNU grep 3.11 2026-09-07 GREP(1)