Public cloud VMware in Kazakhstan
February 2, 2023
Updated August 1, 2023

How to find files which contains defined text in Linux and Windows


How to find files which contains defined text in Linux

The most popular Linux command interpreter is bash. Historically, Linux have had CLI-interface only, graphical environment has been integrated later. It is a reason why we have much possibilities to effective data-manipulation via CLI-interpreter. The best way to find files with required text string in Linux is grep utility. It is built-in tool in all modern Linux operation systems. Most probably that you don't need to install it cause it is exist. But even if not -  you can install this tool anyway.

Command to install in Debian-based OS (like Ubuntu) is:

 apt-get update && apt install grep 

Command to install in RedHat-based OS (like Centos) is:

yum install grep

To find all files with required string just run:

grep -r <looked_for_text> <dir>


To avoid errors message in the output you may add -s flag to the command:


And the last but not least useful flag is -n. This option shows line with out text. It may me useful for large files:



How to do text research on Windows computer

Unfortunately, Windows doesn't have good searching tools "out-of-the-box" but we have some quick'n'easy ways to fix it.

First way is grep utility. It has been "ported" on Windows OS, so you can install it:

Download installer here, run it and follow standard Windows-like installation steps:





When program installed, you should add environment variable to make furher life more comfortable. Just open advanced PC options and edit PATH variable:


Add new option into PATH variable according to the your installation folder:


Then you can run cmd interpreter and do searching. Program syntax is identical to "original" Linux tool:


NOTE: Cause this tool is a Linux port, system root is shown in Linux-style, "slash" instead of C: drive.


Other, more "Windows-like" method is install powerful text editor e.g. Notepad++. Download it from project site, run the app and install it as usual:




To use this app as "text-finder" just run it and choose Search > Find in Files command. Then fill into the appropriate fields searching conditions:



Result is below:



In this article I discribed some ways how to make powerful text search in Linux and Windows.


5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL, United States 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.