Home : Software Terms : Grep Definition


Grep is a command-line utility for Unix used for searching text documents. It can perform basic searches and advanced pattern matching using regular expressions. The grep utility is included with all major Unix distributions, including Linux and Mac OS X.

Grep can be run by simply typing grep at the command prompt. The command requires specific parameters, including the string to be located and the filename of the file to be searched. For example, if you want to check if the file "readme.text" has the word "license" in it, you would type the following command:

grep license readme.txt

If the word is not found, grep will not produce any output. If the string is located in the document, grep will list each occurrence of the string. If you need to perform a more complex search, you can use a regular expression. For example, the command below will search the file "us.txt" and list all lines that begin with "Me" or end with "you" (case-sensitive).

grep -E "^Me|you$" us.txt

The "-E" parameter in the example above indicates the pattern is an "extended regular expression." By using this option, you can make sure grep processes your search pattern as a regular expression instead of a basic string. Grep also supports several other command-line options, which can be used to create more specific queries and customize the output. You can view these options and learn more about grep by typing "man grep at the Unix command prompt.

NOTE: The name "grep" is an acronym that comes from the phrase, "Globally search a regular expression and print."

Updated: September 2, 2013

Cite this definition:


TechTerms - The Tech Terms Computer Dictionary

This page contains a technical definition of Grep. It explains in computing terminology what Grep means and is one of many software terms in the TechTerms dictionary.

All definitions on the TechTerms website are written to be technically accurate but also easy to understand. If you find this Grep definition to be helpful, you can reference it using the citation links above. If you think a term should be updated or added to the TechTerms dictionary, please email TechTerms!

Subscribe to the TechTerms Newsletter to get featured terms and quizzes right in your inbox. You can choose to receive either a daily or weekly email.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe at any time.
Questions? Please contact us.