fgrep
Search for fixed strings (no regex interpretation, equivalent to grep -F).
Synopsis
fgrep [OPTION]... PATTERN [FILE]...
Examples
fgrep '$HOME' script.sh
fgrep -r '*.txt' Makefile
fgrep -c 'Error' log.txt
Common options
| Flag | Description |
|---|---|
| -i | Case-insensitive |
| -r | Recursive search |
| -n | Show line numbers |
| -c | Count matches |
| -l | List matching filenames |
About fgrep
The `fgrep` command search for fixed strings (no regex interpretation, equivalent to grep -F). 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 fgrep`). 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