![]() # Uncomment it if you installed nginx-naxsi To search all the lines that containing specific string in the single file use the following syntax:įor example, search for a string called “nginx” in the file /etc/nginx/nf, run the following command: You should see the grep manual page in the following screen: -l : Used to display filename without matching string.įor more information about grep comamnd, run the following command:.-w : Used to search for matching whole words only.-n : Used to display line numbers in the output.-h : Used to suppress the inclusion of the file names in the output.-r : Used to search directory recursively.-i : Used to ignore case sensitive string.Grep -irhnwl "search string" "directory-path" ![]() The basic syntax of grep command is shown below: Basic Syntax of Grep to Find Strings/Text in Files/Directories In this tutorial, we will show you how to find files that contain specific string in Linux. Grep also know as a “global search for the regular expression” is a command-line utility that can be used to search for lines matching a specific string and display the matching lines to standard output. When you are working on a server that has a big and large set of files, you must have a knowledge of grep command to search files that containing a specific string.įind command is not capable to look inside a text file for a string.
0 Comments
Leave a Reply. |