Grep command in Linux w/ examples

Originally published at: grep command in Linux w/ examples | LinuxBlog.io

This grep command guide is a follow-up of my previous 90 Linux Commands frequently used by Linux Sysadmins article. Every week, or as time allows, I will publish articles on around 90 commands geared toward Linux sysadmins and Linux power users. Let’s continue this series with the grep command. Grep (global regular expression printer) searches through a file for a…

2 Likes

egrep is one of my most used commands. Super, super useful.

1 Like

Thanks for the guide, this is super helpful as I try to learn more commands.

Is it possible to use grep to search many directories for text within a file? If I don’t know where the file is or the name of it, but I know some text within it for example.

1 Like

Thanks for your useful tips.

As several of these commands have options not specified by POSIX you could mention that you are using the GNU grep.

3 Likes

That’s true. You are right. I will make the change. Thanks for joining our tech community.

2 Likes

I think the ‘find’ command may be your friend. I know you can make find run something recursively through your filesystem, and I’m pretty sure the something can be a shell command/script (like grep).

1 Like

Check out this explanation from Brian Kernighan of how the word ‘grep’ came about:

Where GREP Came From - Computerphile

2 Likes