Tuesday, January 7, 2020

Linux: find all the files containing a text string in a directory and its subdirectories

The command is,

grep -H -r "<the text string>" <directory path>

-H  tells it to print the file name when a match is found.
-r or -R tells it to do it recursively.

For example, if you want to find all the files containing the text "master  piece" in the /usr/doc directory and its subdirectories, the command would be this.

grep -H -r "master piece" /usr/doc

If you are interested in finding only a certain type of files containing the text, for instance, all the txt files, you can use the command below to achieve it.

grep -H -r "master piece" /usr/doc | grep .txt

-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.

No comments:

Post a Comment