Hello everyone, I want to share tips in the form of ways to find files that contain certain words on linux. For myself, I sometimes want to edit a file but I forget the location of the file, all I remember is the part of the word I want to edit. So to find it I will use the following command:
grep -Ril "search word" [path]
or it could be
grep -inR "search word" [path]
For example, its use is like this:
Also Read : Replace Word in Editor Vim
According to the picture above, I tried to find the word “Test Searching” in the root path, in the first command it only displays the pathfile and for the second command, besides displaying the pathfile, it also displays the position of the word on which line in the file.
Yes, those are the tips I can give on how to search for files that contain certain words in Linux. Hopefully this is useful for readers, thank you ^^.
0 Comments