The grep -inr
command is a combination of several grep
options used to search for a string in files and directories recursively. Here's a breakdown:
Syntax
Options explained:
-
-i
→ Ignore case (case-insensitive search) -
-n
→ Show line numbers in the output -
-r
→ Recursive search through directories
Example:
This will search for the word "error" (case-insensitively) in all files under /var/log
, displaying line numbers and filenames.
Sample output:
Let me know if you want to add more filters, like file extensions (--include="*.log"
) or excluding certain directories (--exclude-dir="tmp"
).