Pete Freitag Pete Freitag

Case Insensitive Grep Search

Updated on March 12, 2024
By Pete Freitag

To perform a grep search that ignores case, or is case insensitive, use the -i option (or --ignore-case). The grep command is case sensitive by default.

grep -i bob file.txt

The above command will use the grep executable to search the file file.txt for the string bob. It will return each line of the file that contains the word string bob no matter if it is spelled with upper case or lower case letters.

Here we are going to use the longer, but more descriptive grep command line argument --ignore-case to accomplish the same task as above:

grep --ignore-case bob file.txt

As you can see both options will solve our task equally well to perform a case insensitive grep search.

grep bash

Case Insensitive Grep Search was first published on August 01, 2005.

If you like reading about grep, or bash then you might also like:

Discuss / Follow me on Twitter ↯