Search

The fgrep command

Like grep but searching the text literally, without special characters. Equivalent to grep -F.

Syntax

fgrep <texto> [archivo...]

Most useful options

-iIgnores upper and lower case
-vInverts: shows what does not match
-cCounts matches

Copy-ready examples

$ fgrep root /etc/passwdSearch literal text
$ fgrep -c /bin /etc/passwdCount lines with /bin

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Use it when the text has dots or slashes you do not want interpreted as wildcards.

Related commands

FAQ

When do I use fgrep?

When you search for an exact string with special characters, like an IP or a path.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course