Tools
grep
Search text with patterns — flags, regex modes, and context lines.
Usage
grep pattern fileBasic searchgrep -r pattern dir/Recursive searchgrep pattern *.txtMultiple filescat file | grep patternPipe inputMatching
-iCase-insensitive-vInvert (non-matching lines)-wWhole word match-xWhole line match-e patternExplicit pattern-f filePatterns from fileRegex mode
-EExtended regex (like egrep)-FFixed strings, no regex-PPerl-compatible regex-GBasic regex (default)Output
-cCount matching lines-lFilenames only-nShow line numbers-oPrint only the match-qQuiet (exit code only)-m NUMStop after NUM matches--colorHighlight matchesContext lines
-A NUMNUM lines after match-B NUMNUM lines before match-C NUMNUM lines around match