Est. 2007
Turenki

Grep

Grep is a command-line tool for searching inside text files, like code.


Mac’s built-in search is mostly for filenames and reads only certain file types. Grep works with all text files. Here's how you can get started.

grep "word" .

Search for “word” in the current folder.

grep "word" filename.txt

Search inside a file.

grep -r "word" .

Search recursively, from current folder and its subfolders.

grep -l "word" .

Show only the names of files that contain the search term.

grep -i "word" .

Make the search case-insensitive. It finds “word”, “Word” or “WORD”.

Grep is a powerful tool and has many features. Type “man grep” in Terminal to learn more.

Blog articles

60°55’1.2”N
24°38’30.4”E