$grep -Hrn "search string" .
-Hcauses the filename to be printed (implied when multiple files are searched)-rdoes a recursive search-ncauses the line number to be printed
Other useful flags:
-ITo ignore binary files (complement:-atreat all files as text)-Ftreatsearch termas a literal, not a regular expression-ia case-insensitive search--color=alwaysForce colors even when piping throughless. To makelesssupport colors, you need to use the-roption:grep -Hrn search . | less -r--exclude-dir=dirFor excluding directories like.svnand.git.
No comments:
Post a Comment