Easy Tutorial
❮ Linux Comm Umount Linux Comm Cat ❯

Linux rgrep Command

Linux Command Manual

The Linux rgrep command is used to recursively search for strings that match a specified pattern in files.

The rgrep command functions similarly to the grep command, searching for files that contain specified pattern templates. If the content of a file matches the specified pattern template, the rgrep command by default will display the line containing the pattern template.

Syntax

rgrep [-?BcDFhHilnNrv][-R<pattern>][-W&lt;column length>][-x<extension>][--help][--version][pattern][files or directories...]

Parameter Explanation:

Example

To find files in the current directory that contain the string "Hello", you can use the following command:

rgrep Hello *

The search results are as follows:

$ rgrep Hello *             # Searches for files in the current directory containing the string "Hello"
testfile_1:Hello 95         # Sentence in testfile_1 containing the string "Hello"
testfile_2:Hello 2005       # Sentence in testfile_2 containing the string "Hello"

Linux Command Manual

❮ Linux Comm Umount Linux Comm Cat ❯