Bash Grep How to search a file for a pattern

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

To find the word foo in the file bar :

grep foo ~/Desktop/bar

To find all lines that do not contain foo in the file bar :

grep –v foo ~/Desktop/bar

To use find all words containing foo in the end (WIldcard Expansion):

grep "*foo" ~/Desktop/bar



Got any Bash Question?