grep -r string . Before listing and detailing all the options provided by grep, let’s have a quick way to memorize the syntax of the grep command. It’s the command-line equivalent of a modern text editor. In Linux, this is a fairly easy task. Improve this answer. It supports basic and extended regular expressions that allow you to match complex patterns. This tutorial will help you to search all files matching a string recursively. Recursively Search all Files for a String Using grep Command The grep command or egrep command searches the given input FILEs for lines containing a match or a text string. It has built-in features to search for text in a text file. Windows find command is very simple and easy command to work. It searches for the given string pattern or text in the file and print all the lines containing the strings. Finding and locating those files can be done with the find command. Notepad++ searches all subfolders as well by default. Directory: this is the root folder that contains all the files that you want searched. To describe that there can be any character at a certain location of the pattern, use the period character (.). As you can see from the screenshot, grep returns the entire line that contains the word "example." We can also pipe the output of other commands to grep. To show the line number, use the “-n” flag. XFCE4 terminal is my personal preference. As specified above, in order to find text in files on Linux, you have to use the grep command with the following syntax $ grep