egrep
Search for extended regular expression patterns (equivalent to grep -E).
Synopsis
egrep [OPTION]... PATTERN [FILE]...
Examples
egrep '(error|warning|critical)' log.txt
egrep -rn '^import .+ from' src/
egrep '[0-9]{3}-[0-9]{4}' contacts.txtCommon options
| Flag | Description |
|---|---|
| -i | Case-insensitive |
| -r | Recursive search |
| -n | Show line numbers |
| -v | Invert match |
| -c | Count matches |
About egrep
The `egrep` command search for extended regular expression patterns (equivalent to grep -E). Search commands help you locate files, text patterns, and executables across the filesystem.
Efficient searching is critical when working with large codebases or troubleshooting system issues. These tools range from simple filename lookups to full regular-expression pattern matching across file contents.
The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man egrep`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Search Commands
Other commands in the Search category