[grep] Search for a literal string

Created on November 30, 2026

Use grep -F to interpret the search pattern as literal text. Here the period matches a period.

printf '%s\n' 'a.b' 'axb' 'a-b' | grep -F 'a.b'
a.b

-F is short for --fixed-strings. You can pass strings containing regular expression punctuation without escaping that punctuation.

Reference

Shell command grep