How to search a file for a pattern

suggest change

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 find lines that end with foo (grep uses regular expressions, not shell wildcards):

grep 'foo$' ~/Desktop/bar

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents