Grep command in Linux w/ examples

Originally published at: grep command in Linux w/ examples

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…

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

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.

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.

2 Likes

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

1 Like

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