Skip to content
Why Is It Called 'grep'? — The Origin of the Term

Why Is It Called 'grep'? — The Origin of the Term

DodaTech Updated Jun 20, 2026 2 min read

The Story

In 1974, Ken Thompson was working at Bell Labs on the Unix operating system. He needed to search files for patterns — but the ed editor’s search was cumbersome for large files. So he wrote a standalone tool that did one thing perfectly: find text.

The name came straight from the ed command g/re/p. Here’s what it meant:

  • g — global (search the entire file, not just the current line)
  • re — regular expression
  • p — print (output matching lines)

Thompson typed g/re/p so often that extracting it into its own program was inevitable. He famously wrote grep in a single weekend. The name is about as literal as Unix commands get.

How It Evolved

grep became a cornerstone of Unix philosophy — do one thing and do it well. Programmers use it daily to search codebases, log files, and data streams. Its influence spread to every modern programming environment.

Larry Wall later created egrep (extended grep) with richer regex support and fgrep (fixed-string grep) for literal searches. Modern grep absorbs both with flags: grep -E for extended regex and grep -F for fixed strings.

The verb “to grep” entered programmer vocabulary — meaning to search through text quickly. You’ll hear developers say “I grepped the codebase” as naturally as “I searched the codebase.”

Did You Know?

Ken Thompson’s original grep source code was about 500 lines of C. Today’s GNU grep has over 20,000 lines but still follows the same principle: match patterns against text and print results. The g/re/p abbreviation is one of the most famous three-letter acronyms in computing.

FAQ

Who invented grep?
Ken Thompson invented grep at Bell Labs in 1974. He extracted it from the ed editor’s g/re/p command and turned it into a standalone Unix utility.
What's the difference between grep, egrep, and fgrep?
grep uses basic regular expressions. egrep (extended grep) supports additional regex features like +, ?, and alternation with |. fgrep treats the pattern as a fixed string with no regex interpretation. Modern grep unifies them with -E and -F flags.
What does g/re/p literally mean?
It means “globally search for a regular expression and print the matching lines.” The g is global, re is regular expression, and p is print — all from the ed editor command syntax.

Related Etymologies

Why Is It Called 'Patch'? Why Is It Called 'Daemon'?

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro