Linux/Mac Terminal Tutorial: The Grep Command – Search Files and Directories for Patterns of Text

Video is ready, Click Here to View ×

In this Linux/Mac terminal tutorial, we will be learning how to use the grep command. The grep command allows us to search files and directories for patterns of text. You can also pipe the output of one command into grep to get certain matches. It’s extremely useful once you learn the ins and outs. Let’s get started…

The code from this video can be found at:

Regular Expressions Tutorial:…


  1. If you have a requirement to often grep through huge files, I strongly recommend checking out "ripgrep" or "rg" for short. I use it on a daily basis and love it for its multithreading and beautiful output. It's written in Rust and available in brew and some Linux distributions.

  2. Coincidentially, I had just tried out grep yesterday after completing the "Terminus" game. Today my colleague was very impressed when in a matter of seconds, out of 7500 case files, I picked those 40 or so which contained one certain word. also you can export the results easily into a file (I use &>>filename.txt (.csv also works)), which might come in handy if your boss wants "all the contracts with the Miller Company ASAP", or if you want to quickly mail a list of relevant files. As always, great video!

Leave a Reply

Your email address will not be published.