Why Is It Called 'grep'? — The Origin of the Term
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
Related Etymologies
Why Is It Called 'Patch'? Why Is It Called 'Daemon'?
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro