If you only want to list the filenames containing the exact whole word text (as opposed to the default partial word matching), and not things like texting, 123text, and so on, you'd need to append the -w (whole words) command line option, like this: If you require following all symbolic links, use -R instead of -r. r stands for recursive, reading all the files in the directory and its subdirectories. This includes strings like texting for example, because it contains our search pattern, text. This lists all the files in the current folder and subfolders containing text. To do this, you need to open the terminal, navigate to the folder where you want to perform the search, and run: Say you want to search for the word text (case-sensitive!) in all the files in the current directory and its subdirectories. Grep is a command-line utility which prints lines that match a given pattern, and should be installed by default. For this we'll use grep, a standard Unix program. This article explains how to find all files containing specific text on Linux.
0 Comments
Leave a Reply. |