grep is a basic Unix command that helps you quickly find elements of text by providing a search pattern. If matching lines found, they are printed in your terminal session.
Basic grep usage
In the simplest form, grep takes two parameters: word to search for and file name to look in.
This example shows how to look for "ubuntu" word in the /etc/hosts file:
greys@ubuntu:~ $ grep ubuntu /etc/hosts
127.0.1.1 ubuntu
See Also
- Basic Unix commands
- Show Next Few Lines with grep