12 Practical Examples of Linux grep Command

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux course in 5 Days

We are thankful for your never ending support.

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...

14 Responses

  1. vikky says:

    how to use grep command?

  2. 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?

  3. 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 150K+ Linux Users
  1. 100,756
  2. 5,113
  3. 36,418

Enter your email to get latest Linux Howto's