The search process of this program is very efficient even when dealing with a wide scoop of directories/files, grep does not store any lines it copies a line into a buffer, check for the search string, then print the line if a match was found.ĭespite the fact that searching for a given string is the objective of this tool, one of its features is excluding lines that match the given search string from the output while recurring through the directory tree.
We can achieve this by utilizing a wide range of command line options (flag keywords) and Regular Expressions patterns. Surprisingly this simple tool is by far one of the most useful command line tools in Linux it provides various additional and useful features that make the search queries less time consuming and more effective. Grep or global regular expression print is a command line utility to search input files for a search string and returns the matching lines it searches through either information piped to it or files in the current directory. In this article we’ll learn about with a wide range of features to exclude directories, skipping files and selecting non-matching results while searching files with grep.