Search

fgrep

Search for fixed strings (no regex interpretation, equivalent to grep -F).

Synopsis

syntax
fgrep [OPTION]... PATTERN [FILE]...

Examples

Search for literal $HOME without regex
fgrep '$HOME' script.sh
Search for literal *.txt
fgrep -r '*.txt' Makefile
Count lines with literal 'Error'
fgrep -c 'Error' log.txt

Common options

FlagDescription
-iCase-insensitive
-rRecursive search
-nShow line numbers
-cCount matches
-lList 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

Related tools