Global Regular Expression Print
Jump to navigation
Jump to search
grep
Print lines from text that match patterns, basic regex is used by default
Use
grep /etc/ssh/sshd_config pattern match pattern in /etc/sshd_config, case sensitive
Useful Flags
-E use extended regex
-A x print x lines after matched pattern
-B x print x lines before matched pattern
-C x print x lines before and after matched pattern, results separated by "--"
-c print number of matches
-i case insensitive
-mX limit number of matches to X
-n print line number from file
-o only print matched pattern
-R recursive search in a given folder, follow symlinks
-r recursive search in a given folder, don't follow symlinks
-v match inverse
-w match whole words only