grep
Text ProcessingSearch for patterns in files or output
Options & Flags
Available options for this command
-iCase-insensitive search
-rRecursive search in directories
-nShow line numbers with matches
-vInvert match (show non-matching lines)
-cCount matching lines
Examples
Common usage examples
Search for 'pattern' in file.txt
grep 'pattern' file.txtRecursively search for 'error' in log files (case-insensitive)
grep -ri 'error' /var/log/Find nginx processes
ps aux | grep nginxNotes
- Supports regular expressions for complex pattern matching
- Use quotes around patterns with spaces or special characters