What’s Difference Between Grep, Egrep and Fgrep in Linux?

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 courses

We are thankful for your never ending support.

Gunjit Khera

Currently a Computer Science student and a geek when it comes to Operating System and its concepts. Have 1+ years of experience in Linux and currently doing a research on its internals along with developing applications for Linux on python and C.

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

8 Responses

  1. Dhimant Thanki says:

    really very good explanation.This is the first site and last site where i found perfect explanation of these 3 commands of linux

  2. ipozgaj says:

    1. pgrep is not Perl grep, it’s process grep (from the same package as pkill)
    2. “Perl” grep is pcregrep, grep that support Perl flavor of regular expressions
    3. You don’t need to use -C 0 as in your examples as 0 is the default value
    4. In the examples you could use either -o (display matched string) or –color (change color of matched string) so it’s more obvious why a line is displayed

  3. Chad says:

    pgrep is actually “process grep” not “perl grep”

  4. gabi says:

    I think that you got a typo in this sentence

    Like here, when the command is run without escaping ‘(‘ ‘)’ and ‘|’ then it searched for the complete string i.e. “(f|g)ile” in

    Should be

    Like here, when the command is run without escaping ‘\’ ‘\’ and ‘|’ then it searched for the complete string i.e. “(f|g)ile” in

    • Gunjit Khera says:

      No, Actually i am throwing light towards those 3 meta-characters i.e. ( , ) and | . When these were not escaped, complete string was searched i.e. (f|g)ile ,but when they were escaped in the grep pattern, using backslash(\) in front of them, then their meaning changed.

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