tilr.i.p. grep
One of the oldest and most incredible tools in the terminal is grep
1. It was written overnight by the GOAT, Ken Thompson, back in the early 1970s. It allows you to search through a file (or stdin) for a regular expression pattern2. Useful then, useful now. Incredible.
However, it turns out that software written fifty years ago might start to show signs of age. Enter ripgrep, or rg
in your terminal. It is faster, it is aware of your .gitignore
files, it prints results in color, it has a modern RegExp engine, it supports full Unicode, it searches compressed files, it has an easy to use and very powerful set of options, and of course it takes half as many letters to type.
Do yourself a favor and install it:
brew install ripgrep
Want to learn more? Check out the ripgrep project page, this very in depth article explaining why it’s fast and how it works, or this fantastic resource comparing many grep replacements.
-
The name “grep” comes from
↩g/re/p
– globally run a regular expression and print. It was literally that exact command extracted from theed
text editor. There’s a great Computerphile video which tells this story. -
Ken Thompson didn’t invent Regular Expressions, but did popularize their use in computers. One of many reasons he is one of the greatest of all time.
↩