Print file name and line number for each match with color output

grep

  • Find patterns in files using regular expressions.
    More information: <https://www.gnu.org/software/grep/manual/grep.html>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

grep --with-filename --line-number --color=always "{{search_pattern}}" {{path/to/file}}

click the source code to copy install grep on any operating system with command-not-found.com