User Tools

Site Tools


linux:commands:grep

grep searches files for text.

Basic Syntax

grep [options] <text> <file pattern>

Flags

Flag Description
-r Recursively searches files specified in the directory as the <file pattern> argument
-R Like -r but follows symbolic links
-i Ignore case
-n, –line-number Display line numbers

Examples

Recursive, case-insensitive search of the current directy for the word “todo”, displaying line numbers:

grep -rin todo .
linux/commands/grep.txt · Last modified: 2018/03/31 22:29 by dave