GREP

The `grep` command is a powerful utility in Linux used for searching and filtering text in files or input streams. 


The basic syntax for the `grep` command is:

```

grep [options] pattern [file ...]

```


Here, `pattern` is the text or regular expression you want to search for, and `[file ...]` are the file names or input streams to search in. If no files are provided, `grep` reads from the standard input.


Some common options used with `grep` are:


- `-i`: Ignore case distinctions during the search.

- `-v`: Invert the search, i.e., show lines that do not match the pattern.

- `-w`: Match only whole words.

- `-n`: Print the line number of each matching line.

- `-r`: Recursively search for the pattern in all files in the specified directory and its subdirectories.


For example, the following command will search for the word "example" in the file `sample.txt` and display all matching lines:

```

grep example sample.txt

```


You can also pipe the output of another command into `grep` to search for a pattern in the output. For example, the following command will list all files in the current directory and its subdirectories that contain the word "example":

```

ls -R | grep example

```


`grep` is a very powerful tool with many advanced options and use cases. Refer to the `man` page (`man grep`) or online documentation for more information on its usage.