12 Practical Examples of Linux grep Command

Download all articles in PDF format with our TecMint Content Subscription and Linux Support Services starting at $39 per month.

Support TecMint: Did you find this tutorial helpful?. Please help to keep it alive by donating. Every cent counts! - Donate Now

Rob Krul

Rob is an avid user of Linux and Open Source Software, with over 15 years experience in the tech geek universe. Aside from experimenting with the many flavors of Linux, he enjoys working with BSDs, Solaris, and OS X. He currently works as an Independent IT Contractor.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

13 Responses

  1. Mike says:

    Im new to grep, but i have found it very handy.

    I do allot of searching the same files every day and most of the time its a single file
    grep -i -A50 “diskview -j” *-Report* | less -R

    i have this alias that works great thought sometimes i am working on several systems at once and they all have the same file.
    I need to know what array i am looking at but i dont need it to print the file name for all 50 lines.

    So what i was trying to figure out is can i do a grep -i -l “diskview -j” *-Report*

    followed by my original grep command so i get the file name by it self followed by the diskview -j and the next 50 lines?

    Or is this going to produce 3 file names followed by 3 diskveiw -j reports?

  2. Arpan Das says:

    Very useful. Thanks…

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 95000+ Linux Users
  1. 77,543
  2. 4,213
  3. 35,218

Enter your email to get latest Linux Howto's