prints NUM lines of trailing context after matching lines.
processes a binary file as if it were text; this is equivalent to the --binary-files=text option.
prints NUM lines of leading context before matching lines.
prints NUM lines (default 2) of output context.
prints the byte offset within the input file before each line of output.
assumes that the file is of type TYPE if its first few bytes indicate it contains binary data. By default, TYPE is binary, and grep normally outputs either a one-line message saying that a binary file matches, or no message if there is no match. If TYPE is without-match, grep assumes that a binary file does not match; this is equivalent to the -I option. If TYPE is text, grep processes a binary file as if it were text; this is equivalent to the -a option. Warning: grep --binary-files=text might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands.
suppresses normal output; instead, prints a count of matching lines for each input file. With the -v, --invert-match option (see below), counts non-matching lines.
processes the input file as a directory with ACTION. By default, ACTION is read, which means that directories are read just as if they were ordinary files. If ACTION is skip, directories are silently skipped. If ACTION is recurse, grep reads all files under each directory, recursively; this is equivalent to the -r option.
interprets PATTERN as a basic regular expression. (default)
prints the filename for each match.
suppresses the prefixing of filenames on output when multiple files are searched.
processes a binary file as if it did not contain matching data; this is equivalent to the --binary-files=without-match option.
equivalent to -i.
suppresses normal output; instead, prints the name of each input file from which no output would normally have been printed. The scanning will stop on the first match.
equivalent to -l.
uses the mmap(2) system call to read input, if possible, instead of the default read(2) system call. In some situations, --mmap yields better performance. However, --mmap can cause undefined behavior (including core dumps) if an input file shrinks while grep is operating, or if an I/O error occurs.
equivalent to -n.
equivalent to -q.
reads all files under each directory, recursively; this is equivalent to the -d recurse option.
equivalent to -s.
prints the version number of grep to standard error.
equivalent to -v.
selects only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.
equivalent to -x.
outputs a zero byte (the ASCII NUL character) instead of the character that normally follows a file name.