When you are a PC user, using Windows Search is second nature after a while. You can set up your indexing options to find exactly what you need—any document, picture, or music file you want, Windows Search will (usually) find it.
Looking for a more robust file search tool? See what Lookeen has to offer..
What many wonder is if it’s possible for Windows Search to find a document by its content. If you need Windows Search to find file content, for example searching for text within .php, .html, and plenty of other text based files, you will need to add file extensions to your Windows Search Options.
Searching for File Content
The following steps will work on Windows Vista, 7, 8, and 10 in a similar way. The screens and windows may look slightly different from version to version but the process is going to be the same. Here’s what you need to do to get Windows Search to find file content:
- Open your Indexing Options, fastest way to do this is to search for ‘indexing’
- Click on the Advanced button
- Then click on the File Types tab
- In the list that shows up with all the File types, choose the ones that you would like to search the contents of
- At the bottom of the window where it says “How should this file be indexed?” Select the one that says Index Properties and File Contents
- If there’s a file extension that you do not see on the list that you want to be able to search the contents of then you can add it on the bottom where it says Add new extension to list:
- The index will then rebuild for a bit to fit the new options in
This should now have Windows Search finding file content. You can also change Folder Settings to make sure that when you do a search in File Explorer, your results will also show file content. To do so in Windows 8 & 10, follow these steps:
- In any File Explorer window, click File, then Change folder and search options
- Click on the Search tab, then check the box next to Always search file names and contents
- Click Apply then OK
This requires that the index rebuild itself once again, which can take some time. Once that is all done, you will now be able to find file content using Windows Search. If you find that the search results are not up to par, then you may want to look into a third party search program like Lookeen, to find file content quickly and easily.
Home → Articles → How to Search for words within files on Windows 7
Searching for a particular document containing certain words or phrases by scanning through each file yourself, can be both time consuming and frustrating. Why not save yourself some time by using the search function in Explorer. To search for words within files on Windows 7 follow these instructions:
- Open windows explorer
- Using the left hand file menu select the folder to search in
- Find the search box in the top right hand corner of the explorer window
- In the search box type content: followed by the word or phrase you are searching for.(eg content:yourword)
- To narrow down the search it is best to include a file type (eg .doc, .xls). To do this, add the word file: followed by the file type. (eg file:*.doc)
- This will bring up all word documents within that folder that have the word or phrase you are looking for. From here you may select the document that you wish to open.
Want to improve this question? Update the question so it’s on-topic for Stack Overflow.
Closed 6 years ago .
I have to change some connection strings in an incredibly old legacy application, and the programmers who made it thought it would be a great idea to plaster the entire app with connection strings all over the place.
Visual Studio’s “current project” search is incredible slow, and I don’t trust Windows Search.
So, what’s the best free, non-indexed text search tool out there? All it should do is return a list with files that contain the wanted string inside a folder and its subfolders.
I’m running Windows 2003 Server.
6 Answers 6
I’m a fan of the Find-In-Files dialog in Notepad++. Bonus: It’s free.
There is also a Windows built-in program called findstr.exe with which you can search within files.
Windows Grep does this really well.
Edit: Windows Grep is no longer being maintained or made available by the developer. An alternate download link is here: Windows Grep – alternate
Visual Studio Code has excellent search and replace capabilities across files. It is extremely fast, supports regex and live preview before replacement.
I like AstroGrep. The results are shown in a list. A click on a row shows you the whole line as a preview highlighting the hit. It seems to be quite fast, lean and it is free. Tested on Windows 7, 8, 10 and Windows Server 2008 R2. Allows regular expressions.
AstroGrep is a Microsoft Windows GUI File Searching (grep) utility. Its features include regular expressions, versatile printing options, stores most recent used paths and has a “context” feature which is very nice for looking at source code
Visual Studio’s search in folders is by far the fastest I’ve found.
I believe it intelligently searches only text (non-binary) files, and subsequent searches in the same folder are extremely fast, unlike with the other tools (likely the text files fit in the windows disk cache).
VS2010 on a regular hard drive, no SSD, takes 1 minute to search a 20GB folder with 26k files, source code and binaries mixed up. 15k files are searched – the rest are likely skipped due to being binary files. Subsequent searches in the same folder are on the order of seconds (until stuff gets evicted form the cache).
The next closest I’ve found for the same folder was grepWin. Around 3 minutes. I excluded files larger than 2000KB (default). The “Include binary files” setting seems to do nothing in terms of speeding up the search, it looks like binary files are still touched (bug?), but they don’t show up in the search results. Subsequent searches all take the same 3 minutes – can’t take advantage of hard drive cache. If I restrict to files smaller than 200k, the initial search is 2.5min and subsequent searches are on the order of seconds, about as fast as VS – in the cache.
Agent Ransack and FileSeek are both very slow on that folder, around 20min, due to searching through everything, including giant multi-gigabyte binary files. They search at about 10-20MB per second according to Resource Monitor.
UPDATE: Agent Ransack can be set to search files of certain sizes, and using the
Windows Search and its Advanced Query Syntax (AQS) is a freaking awesome feature in Windows. It lets you quickly find a particular file or group of files with a specific name or metadata, in a folder and sub-folders.
Along with indexing file properties or metadata, most known plain-text files are also content indexed by default. When a file type is content indexed, Windows Search lists out the files that contain the word or phrase in the file contents when you type a search phrase in the Search box.
Which Plain-Text Files are “Content Indexed” by Default?
By default, known plain-text file types such as .BAT , .CMD , .CPP , .VBS . Here is the full list of file types that are, by default, content indexed on a Windows 10 computer:
Enable Searching File Contents of Any File Type
If you have a custom file type that is of plain-text format, and want to fully index (except the stop words) the contents, you can add the file extension manually in indexing options. Type Indexing Options in the Start/Cortana search box and click on the search result.
To add custom or unknown plain-text files like, .AHK or .PHP , in the Indexing Options dialog, click Advanced, and click File Types.
Type the file extension PHP , select Index Properties and File Contents radio-button, and click OK. After you press OK, the prompt “Rebuilding the index might take a long time to complete. Some views and search results might be incomplete until rebuilding is finished.” appears.
Click OK, and give the indexer considerable time (maybe even hours) to do its job.
Example: Enable Searching File Contents of PowerShell Scripts (.PS1)
PowerShell script file type .PS1 , although it’s a known plain-text file, is not content indexed by default. To demonstrate this, I have two files with different file extensions, but containing exactly the same PowerShell code.
As you can see, the file contains a word named Defender .
However, when I typed defender in the Search text box, it listed only the text ( .txt ) file. Although the .PS1 file has got the same contents, the file wasn’t listed in the search results.
To search file contents of .PS1 using Windows Search, enable content indexing for the file extension. In Indexing Options, click Advanced, and select the File Types tab. Select .PS1 from the list and enable Index Properties and File Contents radio-button.
Click OK, and give ample time for Windows Search to index the chosen file type. Rebuilding may take anywhere from minutes to hours depending upon the system configuration, number of files waiting to be indexed, and the user activity level in the system. Don’t expect Windows to content index your additional file types immediately.
After some time, Windows Search indexed the contents of all .PS1 files duly, and here are the search results:
Exclude Files in Specific Folders to Prevent the Contents Indexed
Content indexing additional file types mean additional database file size and additional resources consumed by the Search Indexer. To keep the database size down, enable the option only for the files you need. For the rest of the file types, you can choose to index only the file properties and metadata.
Besides configuring content indexing on a per-file type basis, you can exclude certain folders (or files) as well. Right-click on a file or folder, click Properties, and click Advanced.
Note: You can do this on a per-file or per-folder basis.
Uncheck Allow files in this folder to have contents indexed in addition to file properties, and click OK. For folders, Windows asks you whether to apply the settings for files from the current folder only, or for sub-folders as well. Choose the appropriate option and click OK.
From now on, Windows Search will not index the contents of the files present in that particular folder, regardless of your per-file type setting in the File Types dialog in Indexing Options. This helps lower the burden of Windows Search, and keeps the database size smaller.
Search file names only, not contents (even with content indexing enabled)
Sometimes, you may want to prevent Windows search from indexing the contents of documents and archives (without turning off the file content indexing feature), restricting the results to filenames only.
To make Windows Search search only for the file name (not contents), use the search operator filename:
For example, the advanced search query filename:*audit* lists out files that contain the word audit in the file name, regardless of file contents. For accurate searches, always use advanced search operators.
Refine your searches using Search tab Ribbon commands
Don’t like manually typing or memorizing the advanced query syntax? No problem! use the advanced search ribbon buttons in File Explorer Search tab to refine your searches. It fills up the search operators automatically in the search text box.
For demonstration, I added a 0-byte file named defender.txt along with sample.txt and sample.ps1.
The files sample.txt and sample.ps1 contain the word defender inside the file. In this case, typing defender in the search box lists all three files:
That’s because, for freestyle keyword searches, Windows Search looks for the filename, as well as searches the contents (of included file types) for the keyword used. If I used the Advanced Query Syntax (AQS) syntax filename: or name: it searches for the file name only, as seen in the following screenshot.
The filename: operator is always preferred to name: because the name: operator will only search from the beginning of the file name, as opposed to anywhere in the file name.
Similarly, there are many such advanced search operators that you’d like to be familiar with. For example, using the AQS, you can search for Files created between two dates. You can mix and match multiple search operators to refine your searches. With Windows Search’s AQS, the opportunities are endless.
Search file contents even in non-indexed locations
Thus far, everything written in this article applies to indexed locations. For non-indexed paths, Windows has to scour through each file or folder in the file system and fetch the results. This will be accurate, but very slow and drains the system resources more.
By default, in non-indexed locations, Windows Search doesn’t search file contents. If you wish to search file contents in non-indexed locations, there is a setting you can enable.
- Open File Explorer, click the File menu, and select “Change folder and search options”.
- Click the Search tab and enable the option named Always search file names and contents (this might take several minutes)
- Click OK.
It’s worth reiterating that the above setting when enabled, will cause the searches to slow down very much, and the system performance certainly takes a hit with constant churning of the hard drive. Please use the above setting judiciously — enable it only when it’s absolutely necessary.
Many of us depend on Windows Search to find records and start programs, but by default, the search for text in files is limited to specific file types. You can also add other text-based files to your quest. In this article, we will guide you through the whole procedure to use Windows 10 search to scan for text inside any file.
Use Windows 10 Search to scan for text inside any file
To use Windows 10 Search to scan for text inside any file, follow this procedure step by step.
Click the Search button. Type Indexing Options in the search bar and select the Indexing Options option as the following image is showing.
As soon as you will choose the Indexing Options option, the following screen will appear.
Now click the Advanced button at Indexing Options screen as highlighted in the above image. As soon as you will click the Advanced button, the following dialogue box will appear.
Now choose File Types tab in the Advanced Options dialogue box as highlighted in the above image. After choosing the File Types tab, the following options will appear.
Choose the Extension for which you want to scan for text. Then choose the radio button named Index Properties and File Contents and click the OK button as highlighted in the above image. If you haven’t found the extension you want then enter the extension in Add new extension to list textbox and click the Add button. Then click the OK button as the following image is showing.
As soon as the index is rebuilt, you are good to go to scan for text inside any file.
If you always want to check for a particular folder in the file content, then follow these steps.
Open the File Explorer and select the desired folder as the following image is showing.
Then choose the View tab from the ribbon. A toolbar will appear, choose Options option from the toolbar. Then select the Change folder and search options option as the following image is showing.
As soon as you will click the Change folder and search options option, the following dialogue box will appear.
Select the Search tab as highlighted in the above image. As soon as you will choose the Search tab, the following options will appear.
Here check the checkbox named Always search file names and contents (this might take several minutes). Then click Apply and OK button as highlighted in the above image.
By following this procedure you will be able to use Windows 10 Search to scan for text inside any file.
Windows Search does a great job of indexing MSG files and their content, including any attachments. Before you can start searching, you need to configure Windows Search to index the folders which contain your MSG files. Follow this guide to perform the one-time configuration step to add your folders with MSG files to the index.
After that, you will be able to perform searches for any words in the subject, body, attachments, sender name, recipients of the MSG files.
Note: these instructions apply to all MSG files, whether or not you used MessageSave to save Outlook messages.
Add folders to the Windows Search index
Open Windows “Indexing Options” applet.
On Windows 10:
Open Windows Settings – hit Windows Key + I, or click the Start button then click the settings button (gears).
Type “indexing” in the Search box at the top and select “Indexing Options”.
On Windows 7 and 8:
Open the Control Panel.
Type “indexing” in the Search box in the upper-right and click “Indexing Options”.
Click “Modify” at the bottom of the “Indexing Options” window to open the “Indexed Locations” window.
Add folders to the index. In the “change selected locations” pane at the top, expand the drive which contains the folders with MSG files and check the box next to the top level folder.
Click “OK” to close this window.
Wait for Windows Search to index the files. The “Indexing Options” window will show “indexing complete” at the top.
Search MSG files
Type the search words in the Windows Explorer search field (in the upper-right).
If you used MessageSave to save the MSG files you can also enable additional columns which show message specific information, such as “Sender Name”, “Date Modified”, “To”, “Cc”, “Has Attachments”, “Categories”, etc.
We hope you have found this information useful. If you have any questions, do not hesitate to let us know.
You can search for text strings within a project and narrow your search by using different scopes and excluding certain items.
Find the search string in a project
Press Ctrl+Shift+F or select Edit | Find | Find in Files from the main menu.
In the search field, type your search string. Alternatively, in the editor, highlight the string you want to find and press Ctrl+Shift+F . WebStorm places the highlighted string into the search field.
To see a list of your previous searches, press Alt+Down .
If you need, specify the additional options.
WebStorm lists the search strings and the files that contain them. If the search string is found several times on the same line of code, WebStorm merges the results in one line.
To do a multi-line search, click the icon to enter a new line, and press Ctrl+Alt+Down / Ctrl+Alt+Up to browse through occurrences.
Check the results in the preview area of the dialog where you can replace the search string or select another string, press Ctrl+Shift+F again and start a new search.
To see the list of occurrences in a separate tool window, click Open in Find Window . Use this window and its options to group the results, preview them, and work with them further.
If you want to see each new search result in a separate tab in the Find tool window, click on the bottom of the Find in Files dialog and select the Open Results in New Tab checkbox.
Narrow your search
You can use different options in the Find in Files dialog to adjust your search process.
Select options such as Words ( ) or Match case ( ) to find the exact word in a project or match the letter case.
With selected, WebStorm automatically escapes special regex symbols with backslash \ when you search for a text string that contains them.
Keep in mind that if you copy ( Ctrl+C ) the string first and then paste ( Ctrl+V ) it in the search field, the regex symbols will not be taken into account.
For more details on regex , refer to the search with regex documentation.
Click the icon to filter your search. For example, you can filter the search to omit comments or search only in comments instead.
Select Directory to limit your search to a specific folder.
Moreover, you can select the Scope option that offers you a list of predefined scopes for your search. For example, you can limit your search to the scratch files in your project.
If you work without tabs, the scope Recently Viewed Files or Recently Changed Files option might become quite useful. You can also create your own custom scope, click the Browse icon ( ) to open the Scopes dialog.
Search in the specific file types
Use the File Mask option to narrow your search to a specific file type. You can select the existing file type from the list, add a new file type, or add an additional file mask syntax to search for file types with certain patterns.
In the Find in Files dialog, select the File Mask checkbox and from the list of file types, select the one you need.
WebStorm limits its search to the specified type.
If you don’t find the file type you need in the list, enter your file type in the File Mask field.
For example, use the following syntax to search only in json files: *.json .
Besides * , other wildcards are supported. If necessary, specify several file types using commas as separators.
Replace the search string in a project
Press Ctrl+Shift+R to open the Replace in Path dialog.
In the top field, enter your search string. In the bottom field, enter your replacement string.
Click one of the available Replace commands.
Searching for a file in Windows is not an easy job if your files are not organized and one of the ways to search your files using tags keywords in the Windows Search box inside File Explorer. However, Windows File Explorer search results are not that accurate and it takes a longer time but why wait if you can search files much faster using Windows 10 Command Prompt.
Finding Files Using Windows 10 Command Prompt.
You can search files on your hard drive faster using Windows Command Prompt.
Step 1: Press Start and type CMD, then press Enter to launch the Command Prompt. After successfully launching the Command Prompt, type the below command, and press Enter to pull up a list of files and folders.
Step 2: For moving down into a particular directory, use the below command followed by a folder name, until you reach the folder you want to search.
Step 3: Now type dir command again but this time with your search term, follow dir with your search term in quotes with an asterisk term before closing the quotes (For example, type dir “Raveling*”) and press Enter. The command prompt will show you the file location along with the list of files name starting with a similar keyword.
The asterisk is what’s known as a wildcard and, in our example, it stands for anything that follows the word ‘highlands’, such as ‘raveling.doc’, ‘raveling.xls’ or My Business plans.txt’.
If you don’t know the exact location of your file in your hard drive, then instead of manually navigating through your directories, start searching from the very top level of your hard drive and include every sub-folder.
Step 4: The top level of the drive is represented by a backslash and, to include subdirectories, you add a forward slash and ‘s’ to the end of the query as shown below:
The above command is my all-time favorite because, with the help of this command, I don’t have to force my brain to remember the location of the files. This trick usually takes seconds to search the entire drive for the file.
You can also search for a particular file type by using a command dir \*.pdf /s and it will show you all files saved with the .pdf extension. You can try this for other files too (for example: .doxc, .png, .exe and more).
Note: The position asterisk symbol in the command matter a lot so type carefully and check once before executing the command.
How all these commands work.
Now you know enough to find any file on your entire hard drive within few seconds but if you are more curious to know how all these commands are working and what all these symbols stand for, then continue reading this post.
Let’s discuss each term one by one:
- dir command is for showing files on the current directory, but it can also show files from anywhere in the drive of the system.
- / tells dir to search from the top-level or root directory of the hard drive.
- /s is used for searching sub-directories.
- * asterisk is using before text (for example *.pdf) show all files ending with .pdf and * using at the end (for example raveling*) show you all file-names starting with that word.
So, this is all that you need to know for searching any file quickly within a few seconds using Windows 10 Command Prompt.
If you’d like to always search within file contents for a specific folder, navigate to that folder in File Explorer and open the “Folder and Search Options.” On the “Search” tab, select the “Always search file names and contents” option.
How do I search for text in a folder?
How to Search for words within files on Windows 7
- Open windows explorer.
- Using the left hand file menu select the folder to search in.
- Find the search box in the top right hand corner of the explorer window.
- In the search box type content: followed by the word or phrase you are searching for.(eg content:yourword)
How do I search for a word in a document in Windows 10?
To open the Find pane from the Edit View, press Ctrl+F, or click Home > Find. Find text by typing it in the Search the document for… box. Word Web App starts searching as soon as you start typing.
How do I search for a string in multiple windows?
Go to Search > Find in Files (Ctrl+Shift+F for the keyboard addicted) and enter:
- Find What = (test1|test2)
- Filters = *. txt.
- Directory = enter the path of the directory you want to search in. You can check Follow current doc. to have the path of the current file to be filled.
- Search mode = Regular Expression.
How do I search for files in Windows 10?
How to search on a Windows 10 computer via the taskbar
- In the search bar located on the left-hand side of your taskbar, next to the Windows button, type the name of the app, document, or file that you’re looking for.
- From the search results listed, click on the one that matches what you’re looking for.
How do I search within a file?
To search for files in File Explorer, open File Explorer and use the search box to the right of the address bar. Tap or click to open File Explorer. Search looks in all folders and subfolders within the library or folder you’re viewing. When you tap or click inside the search box, the Search Tools tab appears.
How do I find files with certain words?
Open the Documents folder in File Explorer and click in the Search Documents text box. Type your search word or phrase there. When you click in the Search Documents box the Search ribbon opens with additional tools that you might find useful.
How do I do an advanced search in Windows 10?
Open File Explorer and click in the Search box, Search Tools will appear at the top of the Window which allows the choosing of a Type, a Size, Date Modified, Other Properties and Advanced search.
Does Windows 10 have my Documents?
By default, the Documents option is hidden in the Windows 10 Start menu. However, you can re-enable this feature if you want to have another method of accessing your Documents.
Why is find not working in notepad?
Hit Alt+SPACEBAR, which should open up the FindResults title-bar-menu. If it opens the Notepad++ title-bar-menu instead, click in Notepad++ window again, and hit F7 again, then hit Alt+SPACEBAR again. It should bring up your normal Restore / Move / Size / Minimize / Maximize window – even if you cannot see it.
How do I search for a file in a string in Windows?
If you want to find specific text in files, in a command line output or elsewhere, you may use the findstr command on Windows to do so. Findstr is a built-in tool of the Windows operating system that you may run from the command line to find text in files or in command line outputs.
How do I search for a file pattern in Windows?
Findstr command on Windows is useful for searching for specific text pattern in files. It’s functionality is similar to the grep command on Linux OS. You can find below the syntax of ‘findstr’ for various use cases.
What is the shortcut key for search in Windows 10?
The Most Important (NEW) Keyboard Shortcuts for Windows 10
|Keyboard shortcut||Function / Operation|
|Windows key + L||Lock the computer|
|Windows key + I||Open settings / information|
|Windows key + H||Share content (if supported by the active app)|
|Windows key + S||Open Search|
How do I search for files and folders in Windows 10?
Search File Explorer: Open File Explorer from the taskbar or right-click on the Start menu, and choose File Explorer, then select a location from the left pane to search or browse. For example, select This PC to look in all devices and drives on your computer, or select Documents to look only for files stored there.
Using third-party apps or command line
Ever had to find some text inside a bunch of different text files? If you’re in IT, this issue can come up quite often. Maybe you are looking for a particular phrase in log files or maybe you are a programmer and need to find some code that is inside many different code files.
Unfortunately, there isn’t any easy way to do this in Windows. The default Windows search is terrible for this kind of task because it’s super slow and doesn’t allow for advanced searches. Luckily, there are several other ways that are far superior to Windows search, which I will mention in this post. I won’t go into great detail about each solution, but you can use Google to learn more.
If you don’t want to install any third-party software and you are comfortable with the command line, then you should check out the built-in search commands section below. I’m assuming most people are more comfortable with GUI interfaces, so that’s why I mention the programs first.
Third-Party Search Programs
When it comes to searching multiple text files, the king of all search commands is grep. grep is a command line utility in UNIX/Linux that allows you to perform advanced searches using regular expressions. It’s super popular and used in every distribution of Linux.
So when someone writes a program for searching on Windows, inevitably, it has the word grep in it. That’s pretty much the case with all the programs listed below.
grepWin is probably the most popular out of the tools mentioned here. It supports regular expressions and allows you to find and replace text also. They also have a tutorial on their website to help with regular expressions, though you can Google for many more.
You can limit the search by file size, file type and other criteria. It also adds an option to the right-click context menu in Explorer to quickly search a folder. The results are listed in the bottom window and you can just double-click on them to open the files.
AstroGrep is also another really good search program. Not only does it get updated quite often, it also shows you where in the file the text was found. grepWin also has that option if you choose the Content radio button, but I think it’s implemented better in AstroGrep.
AstroGrep can also search Word files, which is a handy feature. You can also save or print out all of the results for future reference. I also find their interface to be more modern and pleasing to the eye.
BareGrep is a fairly simple search program that supports regular expressions and all the basic search functions. It’s pretty fast overall and shows you matches in a tabular format. The free version has a splash screen that you can’t disable. The pro version costs $25 and seems to just disable the splash screen, otherwise the features are the same.
If you are looking for the ultimate search program, then look for further than PowerGREP. This program has some serious features and a serious price tag to go along with it. It’s a whopping $159! It’s pretty much got all the features mentioned above, plus some more, and all packaged nicely into a pretty little interface.
I only recommend this program if you have some serious search needs that include finding text in Word files, PDF documents, Excel spreadsheets, etc. It can even extract statistics from your log files and give that information to you. It’s quite a powerful tool.
Built-in Windows Commands
If you only need to perform a quick search and don’t want to install a full-fledged program, you can use the built-in command line tools in Windows. One runs in the normal command prompt and the other uses PowerShell. Both are quite powerful and can find pretty much anything you are looking for.
The first command is findstr. You can read the reference document here to learn how to use findstr. You can also type findstr /? at the command prompt and it’ll show you the usage. As you can see, there are quite a few options. Obviously, this is a lot more complicated than using one of the programs above.
The second option is the Select-String command in Windows PowerShell. Again, there is a pretty big learning curve with these commands if you haven’t already used them. Microsoft has a good tutorial on how to use Select-String, so make sure to read that.
So, those are basically the best ways to go about searching for text in a large number of files. I suggest you try out the different options and see which one works best for you. Enjoy!
Founder of Help Desk Geek and managing editor. He began blogging in 2007 and quit his job in 2010 to blog full-time. He has over 15 years of industry experience in IT and holds several technical certifications. Read Aseem’s Full Bio
December 18, 2015 By Admin
By default if you search something in windows computer, it searches matching your query against the file names. It never cares to look what is written inside the file. As in this way the indexes which windows system have to store is of least size, Microsoft has kept this searching option as default. But, what if you do not remember the name of the file, but remember something from inside file’s text. If you want to search required file by text inside file, you have to do a simple tweak in indexing options. Please follow described steps given below to customize Windows 10 to search inside files for text.
Step 1 – Search indexing options in the search box of taskbar. Click on Indexing Options which appears as a search result.
Step 2 – In indexing options window, click on Advanced as shown below.
Step 3 – Now in the advanced options window, select file types tab. Then , select index properties and file contents below how should this file be indexed? as shown in screenshot given below.
Once you click ok, a message saying rebuild has started will be shown to you.
Confirm this and the rebuiilding the index process will start running in the background. It may take several hours to few days depending upon the size of the files on your PC. You can shutdown or reboot and the process will start from where it left. You can search normally and can perform all the windows PC functions normally without any trouble. The windows search will function based on the last rebuild, that means the last settings in indexing options. Once this rebuild process gets completed, your searches will automatically be based on new settings. That means you will be able to search inside files for chunks of texts or words.
Saurav is associated with IT industry and computers for more than a decade and is writing on The Geek Page on topics revolving on windows 10 and softwares.
I like the search in Windows 10 even though I had to tweak it quite a bit to make it behave the way I want it to and am running into search not working issues from time to time.
One thing that I like about it in particular is that it highlights the main results better. This is a small change that puts the focus on the first result and since search gets it right most of the time, it is easier to recognize it and select it with a tap on the enter key.
Anyway, the search is not optimized for speed by default which can be largely attributed to it trying to find web results as well as local results.
Since I don’t consider web results useful at all, I have disabled the feature completely. If I want to search for something on the Web, I do so using a web browser which is open 24/7 anyway.
The next thing I did was optimize the locations that Windows indexes. The operating system indexes several by default including the complete user folder.
While that may not be as bad as it sounds, you will find many locations in the user folder that you may not want indexed or returned by search. For instance, you may have programming project directories and repositories there with thousands of files and directories, or other larger file collections that you have no interest in being returned by Windows 10’s search.
There is also the AppData folder with hundreds of thousands of files, for instance web browser cache and cookies.
When it comes to the list of indexed files, it is best to only include locations that you want results to be returned from.
If you don’t use Internet Explorer for instance, you may not want Internet Explorer favorites to be returned, ever. That’s however one of the default locations included automatically by search indexing.
Manage search Indexing Options on Windows 10
Do the following to open the Indexing Options:
- Use the keyboard shortcut Windows-Pause to open the System control panel.
- Click on “All control panel items” in the location bar at the top.
- Locate and click on Indexing Options.
The window that opens displays all locations that are included by Windows 10’s search indexer. The exclude listing next to each location lists subfolders of that location that are blocked from the indexer.
To get started click on modify to open the list of indexed locations and a folder browser to select new ones.
First thing you may want to do there is to click on “show all locations” as Windows hides some. A click on a location that is included jumps to it in the “change selected locations” pane which is the fastest method to uncheck them.
The indexer lacks a search option to find locations quickly which means that you need to click your way through the structure to include new locations.
- Portable software is usually not included by search by default unless you have placed the programs in the user folder. Simply add the root folder of your portable software collection to the index to gain access to all programs stored in it using Windows Search.
- The exclude option is powerful and it makes sense to make use of it to block folders from being indexed. For instance, while you want to index the user folder, you may disable the indexing of folders listed in it you don’t require them to be included in search.
- Some files and programs get indexed automatically. You may launch msconfig.exe or Settings at all time even if you disable all locations in the Indexing Options.
Once you have added all locations you want included, click on ok to get back to the main menu. There you need to click on the advanced button to manage advanced settings.
You find two interesting options there. First, you may move the location of the index to another drive. This can be useful if a faster drive is available that you could store the index on to speed it up further.
Second, you may want to open file types and disable those that you don’t require.There is no option to disable all file types and select the ones you want only, which means lots of clicking if you want to go down that route.
I suggest you try the search first to see how fast it is. Disabling certain file types prevents them from being tracked which may reduce search pollution.
Windows Search distinguishes between indexing file properties only, or file properties and file contents. For example, Search may index Word document content automatically and return results when you search.
Properties include metadata only which may include the file name, title or author while file contents the actual (text) contents of files.
Search Index needs to rebuild whenever you make modifications in Indexing Options. You can run a manual rebuild at any time from the advanced menu.
There you find options to troubleshoot search and indexing as well which launches a small program that checks common problems and attempts to fix them if found.
Third-party desktop search programs for Windows are a great alternative as they give you more control over the indexing and are often faster and more reliable than Windows Search.
Now You: Are you using Windows Search or a third-party search program?
In this post, we will share tools and Windows inbuilt service to help you search a word inside multiple files in Windows 10. While Windows 10 offers a powerful search, especially compared to Windows 7, sometimes the complexity is such that Windows 10 default search might not work. So we will have to use third-party applications to meet the need. On top of that, Windows 10 search doesn’t offer flexible UI as other tools.
How to search a word inside multiple files in Windows 10
- Windows 10 Search
- PGrep utility
- Text Crawler
1] Using Windows 10 to search text in files
If you want to use Windows 10 to find text in a file, then you have two options. First is to use the Start menu if you’re going to do a global search or open the folder in file explorer, and then do a search which will be limited to that folder. Windows 10 can do this if the option to Index Properties and File Contents is enabled.
- Type indexing in the Start menu, and click on Indexing options when it appears
- Then click on Advanced> File Types
- Click on the option “Index properties and file contents.”
If you have enabled it for the first time, you should wait for the indexing to complete. To find text in a file, follow these steps
- Open File Explorer
- Type the content you are looking in the search box, and you should see a list of files appearing. Hit enter to view the result in File Explorer.
In case you are not able to find, read our guide on how to fix Windows 10 file indexing issues.
2] PGrep utility
If the Windows search is not helpful, then you will need to use third-party software, especially to find complex words. PRGrep is a free utility that allows you to search for a word or phrase in single or multiple text files. The output gives a clear idea in several lines, a complete path, and highlights wherever it is present.
Features of PGrep Word finding software
- Supports text search in files that are located in subdirectories.
- Multiple File search both text and binary.
- Its free and can be downloaded.
- It allows you to save your search parameters for re-usability.
- Export your search result in .csv,.txt, excel, and XML format.
- Allows you to open the files which are found in search result directly from the application in one click.
- It uses Grep utility, which is one of the most advanced search functions used for the same purpose; the results are very accurate.
I find this utility very handy for any class of people. It’s a boon to people who are not tech-savvy and find it challenging to look for the word in this situation. Do you use a search tool? If you have better or similar software, do tell us in comments.
3] Text Crawler
Using this software, you can search, delete, insert, and replace text across files in any subfolder. It supports Regular expression in case your documents are complex or when you try to scan large files. More on Text Crawler.
This application lets you add multiple words that are searched in the document, and for each of them, a replacement can be set, and then all of it can be run in one go. Replace All in short. More on wReplace.
I hope these tools were easy to use, and you are now able to find words inside text files.
These desktop search tools are useful for searching specific files that are scattered everywhere, probably due to bad file and folder management. One may wonder who needs this? System administrator or people that do not have the habit of properly organizing their files. If the computer does not belong to you, this tool makes searching easier.
↓ 01 – Everything
“Everything” is a search engine that locates files and folders by filename instantly for Windows. Unlike Windows search “Everything” initially displays every file and folder on your computer (hence the name “Everything”). You type in a search filter to limit what files and folders are displayed.
↓ 02 – grepWin
grepWin is a simple search and replace tool which can use regular expressions to do its job. This allows us to do much more powerful searches and replacements. The software adds an input to the shell context menu to look for the chosen folders, effortlessly. Once the software is launched, it lets you customize the search function or restoration feature in multiple methods.
↓ 03 – Agent Ransack
Finding files that other search engines miss. Agent Ransack is a free software program for finding files on your PC or network drives. It is a ‘lite’ version of FileLocator Pro and is free for both personal and commercial use.
- Immediate results – Found text is shown with highlighted keywords so you don’t need to waste time opening each file looking for the right information.
- Boolean expressions – Combine search terms using the familiar Boolean operators AND, OR, NOT.
- Fast searching – Highly efficient search algorithms mean that you spend less time waiting for results.
- Office formats – Support for popular Office formats including Office 2010 and OpenOffice.
↓ 04 – Listary
Listary is a revolutionary search utility for Windows that makes finding your files and launching applications blazing fast, for casual and power users alike! With Listary you’ll never have to go through the tedious process of browsing through folders, looking for the right file names and hunting through Windows’ limited menus ever again. With just a few clicks you can quickly and easily:
- Search the entire disk drive from any window or folder
- Quickly find any file you need with a few short keystrokes
- Instantly find & launch programs with a quick keyboard command
- Copy or move files to any folder from any folder with easy context menu commands
- Open a file with a specific program from anywhere
- Instantly jump from file manager to a target folder with a simple key command
↓ 05 – AstroGrep
AstroGrep is a Microsoft Windows grep utility. Grep is a UNIX command-line program which searches within files for keywords. AstroGrep supports regular expressions, versatile printing options, stores most recently used paths and has a “context” feature which is very nice for looking at source code.
This lightweight program, AstroGrep is specially designed to search for files in a user-defined location. This is a portable application that doesn’t leave any footprints behind in the Windows Registry. What’s interesting is, you can transfer it on any USB flash drive or on any other devices.
↓ 06 – SearchMyFiles
SearchMyFiles is an alternative to the standard “Search For Files And Folders” module of Windows. It allows you to easily search files in your system by wildcard, by last modified/created/last accessed time, by file attributes, by file content (text or binary search), and by the file size. SearchMyFiles allows you to make a very accurate search that cannot be done with Windows search.
↓ 07 – DocFetcher
DocFetcher is an Open Source desktop search application: It allows you to search the contents of files on your computer. — You can think of it as Google for your local files. The application runs on Windows, Linux and OS X, and is made available under the Eclipse Public License.
Search for a text string in a file & display all the lines where it is found.
If a [pathname] is not specified, FIND will prompt for text input or will accept text piped from another command.
(use CTRL-Z to end manual text input)
If searching for text that contains double quote characters ” , they must be escaped by doubling to “”
This is in addition to enclosing the entire string in quotation marks: “The “”main”” event”
The FIND command will output a string of 10 dashes ———- followed by the filename being searched, followed by any matching lines of text in the file.
0 String found in at least one of the files.
1 String not found
2 If any files in the list do not exist or if no files match a wildcard mask. An invalid switch is given.
Find does not support wildcards, use FINDSTR instead.
Although FIND can be used to scan large files, it will not detect any string that is positioned more than 1070 characters along a single line (with no carriage return) This makes it of limited use in searching binary or XML file types.
An empty string “” will normally match nothing, with the /v flag reversing the test, to match everything, but this will fail for any lines longer than 4091 characters long.
If names.txt contains the following:
To search for “Shameika” in names.txt
If you want to pipe the output from a command into FIND use this syntax
You can also redirect like this
To search a folder for files that contain a given search string:
Count the number of lines in a file (like wc -l on unix).
The empty string “” is treated as never matching. The /v flag reverses the test, so now it matches everything and then /c returns the count:
“For my art, there is a common theme most of the time: it is using the things we can see to search for the world we cannot see”
FINDSTR – Search for strings in files, supports regular expressions.
ATTRIB – Find filename (rather than searching the file contents.)
Redirection – Spooling output to a file, piping input.
Escape chars, delimiters and quotes
Agent Ransack – Free File Searching Utility.
Equivalent PowerShell: Where-Object – Filter objects passed along the pipeline.
Equivalent bash command (Linux): awk/gawk – Find and Replace text within file(s).
Arnoldas Zdanevicius needed help finding a file. Luckily, Windows’ built-in search tool can be a powerful ally—if you know its tricks.
At first glance, Windows’ search tool seems simple but underpowered. You open up Windows Explorer (File Explorer in Windows 8), type a word in the search field, and files containing that word appear. But there’s really much more to it than that.
[Have a tech question? Ask PCWorld Contributing Editor Lincoln Spector. Send your query to [email protected].]
To begin a search, pick a location to search through. Open Windows/File Explorer and go to the location you want to search. If in doubt, try Documents, your user folder, or the whole drive. Windows will search through that location and its subfolders.
But remember that searching through unindexed folders slows things down considerably. So what’s indexed? By default, your libraries (Documents, Music, Pictures, and Video), email, and other common data folders. To see and possibly change what’s indexed, type index into the Start menu’s Search field or Windows 8’s search charm, and select Indexing Options.
Once you’ve got Explorer up in the right location, type the word you’re looking for in the Search field, which you’ll find in the upper-right corner of the Explorer window. You’ll soon get a list of every file containing that word in either the file name, the contents, or the metadata.
But searching for more than one word complicates things. For instance, if you typed daisy miller (upper- and lowercase is irrelevant here), you would get every file containing the full name Daisy Miller. But you’d also get every file containing the words daisy and miller, even if there are hundreds of words between them.
To find only files with the name, type “daisy miller” with quotation marks as shown, so it will be treated as a whole phrase and not two separate words.
There are other options: daisy NOT miller will bring up files that have the word daisy but not miller. Daisy OR miller would find every file that has either of these words.
By the way, NOT and OR have to be capitalized. daisy not miller will find every file with those three words.
You’ve probably noticed that filter options appear when you click the search field—although which filters pop up will vary as Windows tries to second-guess you. You might get Authors, Kind, Date modified, Type, and so on. What’s the difference between Kind and Type? Kind filters by broad definitions—documents, pictures, and so on. Type really means file extension—DOCX, XLS, JPG, and so on.
If the filter you want doesn’t show up, just type it. When you type or select a filter, you’ll get a pull-down list of options.
And that brings us to the metadata filters. You can type in the name of a metadata field—say, tag: —and a word, and Windows will find any file with that word in that metadata field.
Linux, regardless of the distro you use, comes with a number of GUI tools which allow searching for files. Many modern file managers support file searching right in the file list. However, most of them do not allow you to search inside a file’s contents. Here are two methods you can use to search for file contents in Linux.
I would like to share the methods I use myself.
The first method involves the grep utility, which exists in any distro, even in embedded systems built on busybox.
To find files containing specific text in Linux, do the following.
- Open your favorite terminal app. XFCE4 terminal is my personal preference.
- Navigate (if required) to the folder in which you are going to search files with some specific text.
- Type the following command:
Here are the switches:
-i – ignore text case
-R – recursively search files in subdirectories.
-l – show file names instead of file contents portions.
./ – the last parameter is the path to the folder containing files you need to search for your text. In our case, it is the current folder with the file mask. You can change it to the full path of the folder. For example, here is my command
Note: Other useful switches you might want to use with grep:
-n – show the line number.
-w – match the whole word.
Another method I use is Midnight Commander (mc), the console file manager app. Unlike grep, mc is not included by default in all Linux distros I’ve tried. You may need to install it yourself.
Find files containing specific text with mc
To find files containing some specific text using Midnight Commander, start the app and press the following sequence on the keyboard:
Alt + Shift + ?
This will open the search dialog.
Fill in the “Content:” section and press the Enter key. It will find all files with the required text.
You can place these files in the left or right panel using the Panelize option and copy/move/delete/view/do whatever you want them.
Midnight Commander is a very time-saving tool when it comes to search.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!
Author: Sergey Tkachenko
Sergey Tkachenko is a software developer from Russia who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube. View all posts by Sergey Tkachenko
6 thoughts on “Find Files Containing Specific Text in Linux”
The code that you provided helped me. There are also another commands which I cannot remember to find text in files but this one is made it quickly. I have bookmarked this post for further usage. Thank you.
Notepad++ find in files directory
One of the many useful abilities of Notepad++, is to search multiple text files for a text string and find in files and folders – including subfolder and windows hidden files and folders – and even to find and replace in notepad this search text in all files.
It is even more powerful than windows 7 search in files built in function – and even find files faster than windows 8 search file contents and windows 7 explorer search.
Search for a word in all files in a folder
To do so, open the Search menu => Find in Files. press CTRL + SHIFT + F, or go to Search with CTRL + F and open the Find in Files tab.
Search text in files windows 7
Once there, enter your search string in files (for example 8080) in the Find what field. Then, click on the . button at the right side of the Directory field.
Select the file folder directory in which you’d like to search for files containing text.
Windows search within files
Enter your folder and search options. On top of the standard Notepad++ search options, you might want to check the In all sub-folders and / or In hidden folders options, to make sure the search is done on all subfolder and also hidden file folder.
Click on Find All once you have set up your search criteria.
How to find hidden folders
You will be returned the list files and directories containing result : how many results in how many files, and, for each file matching your search criteria, the file location, and the line number of each result.
Double click on the filename to show / hide the detail, and double click on the line result to open the file, showing the result line with search highlighted.
This is also a way how to find hidden files on windows, if you know some text they might contain.
Windows search text in files and folders with Notepad++
Issue: How to fix File Explorer error “No items match your search” in Windows 10?
Hello. I hope you guys can help me. Every time I type something into the Windows search box, it returns no results. I know that because I tried to search for an item that is definitely on my computer. Please help me!
- Fix 1. Run Search and Indexing Troubleshooter
- Fix 2. Restart Cortana
- Fix 3. Rebuild Indexing services
- Fix 4. Make sure Windows Search Service is enabled
- Fix 5. Pick the Always search file names and contents option
- Protect your online privacy with a VPN client
- Data recovery tools can prevent permanent file loss
The File Explorer  is a useful tool that should find all files and folders based on keywords or exact matches of users’ queries. Nevertheless, users might experience some troubles with it. The most common problem with File Explorer is that it cannot find anything based on the keyword entered, even if the item is located somewhere on the system. Do not worry, as we are here to help you – we compiled solutions that should help you fix “No items match your search” in Windows 10.
The File Explorer error “No items match your search” issue appears due to the search tool not working correctly, i.e., Search feature of File Explorer is broken. The main culprit of malfunction is due to indexing issues on Windows 10. Additionally, the index database could be corrupted. There are several ways of fixing it, and it highly depends on your system configuration and other settings.
When you encounter certain problems with your machine, you should always check if no malware  is causing it. The more common symptoms of virus infection include:
- Constant crashes or slow operation of the software installed
- High CPU/GPU usage
- PCs fan working at maximum capacity
- Computer slowdowns or crashes
- Frequent BSoDs 
- Increased amount of advertisement popping out of nowhere
Unfortunately, some malware may show no signs or symptoms whatsoever. Thus it is always a good idea to obtain a powerful security tool and perform consistent computer scans. We suggest using Reimage Mac Washing Machine X9 . In addition to the ability to scan and remove malware, the program is also capable of automatically fixing various computer issues, including “No items match your search” error.
If Reimage did not fix your problem with File Explorer, proceed with the solutions below.
This video will provide you with information needed to eliminate this problem:
Fix 1. Run Search and Indexing Troubleshooter
Windows has built-in repair tools called Troubleshooters. These programs are capable of detecting certain problems on the PC and repairing them automatically. In this particular case, we need to find Search and Indexing Troubleshooter:
- Press Windows key + R
- Type in Control Panel and press Enter
- In the Control Panel search box type in Troubleshoot
- Then click Troubleshooting > View all
- Select Search and Indexing and click Next
- Let Troubleshooter run and fix all your search problems automatically
In case search in the Run window does not work either, follow these guidelines instead:
- Right-click on Start menu and select Settings
- Navigate to Update and Security > Troubleshoot
- Locate Search and Indexing Troubleshooter and run it
Fix 2. Restart Cortana
Users noted that restarting Cortana  (she controls Windows search) proved to be useful:
- Press Ctrl + Shift + Esc
- Scroll down and find Cortana in the list
- Right click on it and press End Task
Fix 3. Rebuild Indexing services
Search index might be corrupted. Hence your searches return no results. To fix “No items match your search,” follow these instructions:
- Click on Start button and go to All Apps
- Scroll down to Windows System and click on Control Panel
- Select the Small Icon View and choose Indexing Options
- Select Advanced and then click on Rebuild
- When warning pops up, click OK
Fix 4. Make sure Windows Search Service is enabled
To fix the File Explorer Search tool, you need to turn on Windows Search Service (in case it is switched off):
- Press Windows Key + R and type in services.msc and click OK (if it does not work, go to Control Panel > Administrative Tools and double-click on Services)
- Scroll down to find Windows Search and double-click it
- Pick Automatic under the General tab > Startup type
- Press Start, then Apply and finally OK (note: If Windows Search is enabled, make sure you restart it by right-clicking on it and pressing Restart)
Fix 5. Pick the Always search file names and contents option
To make sure that File Explorer search utility searches for files when searching non-indexed items, you need to enable Always search file names and contents option in the following way:
- Open File Explorer and pick View tab
- Click on Options button and then press Change folder and search options on the menu
- Under Search tab select Always search file names and contents and press Apply > OK
- January 2022
- October 2021
- September 2021
- February 2021
- January 2021
- May 2020
- March 2020
- February 2020
- January 2020
- December 2019
- General (20)
- HydraCAD (308)
- HydraCALC (33)
- HydraLIST (27)
- Microsoft Stuff (25)
- Defining Sprinkler Head Part Numbers for AutoList
- Quick Assist – A Screen Sharing/Control App that is part of Windows 10
- Resetting AutoCAD’s Hidden Messages
- Layers Tools and Custom Layer Settings with HydraCAD
- Drawing an Up/Down Sprinkler – Putting an Upright and Pendent on the same Tee
- Using FIND to Isolate Different Hanger Types
- Hanger Rod Cut Lengths – What Controls Them?
- The HydraCARDs Knowledge Base – Online
- Viewing Product Data Sheets in HydraCALC
- Working With Background Drawings #0 – Beginning with the Background
- Arthur Dove on Objectively looking at Object Snaps
- Art on Picking up Fittings, Valves and Backflows in AutoCalc
- Art on Objectively looking at Object Snaps
- James Litvak on Objectively looking at Object Snaps
- Iamjamieq on Objectively looking at Object Snaps
- Iamjamieq on Picking up Fittings, Valves and Backflows in AutoCalc
- George Ali Blackburn on Creating Your Own Templates
- George Ali Blackburn on Using Pressure Reducing Valves
- Jerome Van Kolken on Move Main, Move Line, Erase Main, and Erase Line
- George Ali Blackburn on Designating Exclusion Zone Around Sprinkler Heads for Clash Detection
March 04, 2011
Searching File Contents in Windows 7 Explorer/My Computer
Sometimes, it seems like things take a big step back. This is a good example: try to search for text inside a file in Windows Explorer using Windows 7. It can’t be done by default.
There are two ways, from Wikihow:
1. In Windows Explorer, Press Alt button –> go to Tools –> Folder options –> Search tab –> Here select, “Always search file names and content (this might take several minutes)”.
2. Another way. Type “contents:” in the Windows Explorer search box followed by the word, searches text files. This is a search filter which seems to be undocumented (of course)
But it doesn’t end there. Windows will not search within all files by default, just the ones it ‘understands’. So, if it’s not a .txt or .doc or .rtf or other Microsoft file, you will have to change things.
Here is my own problem. I need to search within a bunch of files (AutoCAD LISP files – .lsp) to find which ones contain a series of text letters. But by default, My Computer/Explorer does not look within .lsp files during a search.
Remember from above that to search for text within a file, you need to add the string ‘contents:’ followed by the word(s) you are searching for to the upper right edit field in Computer/Explorer. See the image below. In it I am searching for all files (or so I thought) containing the text ‘2011’.
The thing is that Windows 7 Explorer does not search within all file types by default. And .lsp files are one of those types. What needs to be done? You need to edit the Indexing for that file type so it is searched.
1.Go into Control Panel and Pick Indexing Options
2. Pick the Advanced button
3. Pick the File Types tab
4. Scan down to the file extension in question. In my case it is lsp. Select it and pick the Index Properties and File Contents option. Pick OK. It should work now.
Note – Notice that the initial dialog in Indexing Options shows a list of folders that are currently Indexed. This list is built as you use search. Windows may occasionally notify you that searches will go faster if you choose to Index a given folder. You can add folders by picking the Modify option and selecting them from the tree that appears.
Posted by Art on March 04, 2011 | Permalink
GitLab Advanced Search expands on the Basic Search with an additional set of features for faster, more advanced searches across the entire GitLab instance when searching in:
- Merge requests
- Wiki (except group wikis)
The Advanced Search can be useful in various scenarios:
- Faster searches: Advanced Search is based on Elasticsearch, which is a purpose-built full text search engine that can be horizontally scaled so that it can provide search results in 1-2 seconds in most cases.
- Code Maintenance: Finding all the code that needs to be updated at once across an entire instance can save time spent maintaining code. This is especially helpful for organizations with more than 10 active projects. This can also help build confidence is code refactoring to identify unknown impacts.
- Promote innersourcing: Your company may consist of many different developer teams each of which has their own group where the various projects are hosted. Some of your applications may be connected to each other, so your developers need to instantly search throughout the GitLab instance and find the code they search for.
Use the Advanced Search syntax
Elasticsearch has data for the default branch only. That means that if you go to the repository tree and switch the branch from the default to something else, then the Code tab in the search result page is served by the basic search even if Elasticsearch is enabled.
The Advanced Search syntax supports fuzzy or exact search queries with prefixes, boolean operators, and much more. Use the search as before and GitLab shows you matching code from each project you have access to.
Full details can be found in the Elasticsearch documentation, but here’s a quick guide:
- Searches look for all the words in a query, in any order – for example: searching issues for display bug and bug display return the same results.
- To find the exact phrase (stemming still applies), use double quotes: “display bug”
- To find bugs not mentioning display, use – : bug -display
- To find a bug in display or banner, use | : bug display | banner
- To group terms together, use parentheses: bug | (display +banner)
- To match a partial word, use * . In this example, I want to find bugs with any 500 errors. : bug error 50*
- To use one of symbols above literally, escape the symbol with a preceding \ : argument \-last
Syntax search filters
Advanced Search also supports the use of filters. The available filters are:
- filename : Filters by filename. You can use the glob ( * ) operator for fuzzy matching.
- path : Filters by path. You can use the glob ( * ) operator for fuzzy matching.
- extension : Filters by extension in the filename. Please write the extension without a leading dot. Exact match only.
- blob : Filters by Git object ID . Exact match only.
To use them, add them to your keyword in the format : without any spaces between the colon ( : ) and the value. When no keyword is provided, an asterisk ( * ) is used as the keyword.
- Finding a file with any content named search_results.rb : * filename:search_results.rb
- The leading asterisk ( * ) can be ignored in the case above: filename:search_results.rb
- Finding a file named found_blob_spec.rb with the text CHANGELOG inside of it: CHANGELOG filename:found_blob_spec.rb
- Finding the text EpicLinks inside files with the .rb extension: EpicLinks extension:rb
- Finding any file with the .yaml extension: extension:yaml
- Finding the text Sidekiq in a file, when that file is in a path that includes elastic : Sidekiq path:elastic
- Finding any file in a path that includes elasticsearch : path:elasticsearch
- Finding the files represented by the Git object ID 998707b421c89bd9a3063333f9f728ef3e43d101 : * blob:998707b421c89bd9a3063333f9f728ef3e43d101
- Syntax filters can be combined for complex filtering. Finding any file starting with search containing eventHub and with the .js extension: eventHub filename:search* extension:js
Filters can be inverted to filter out results from the result set, by prefixing the filter name with a – (hyphen) character, such as:
- Finding rails in all files but Gemfile.lock : rails -filename:Gemfile.lock
- Finding success in all files excluding .po|pot files: success -filename:*.po*
- Finding docs for all files outside the docs/ folder: docs -path:docs/
Search by issue or merge request ID
You can search a specific issue or merge request by its ID with a special prefix.
- To search by issue ID, use prefix # followed by issue ID. For example, #23456
- To search by merge request ID, use prefix ! followed by merge request ID. For example !23456
Global search scopes
To improve the performance of your instance’s global search, you can limit the scope of the search. To do so, you can exclude global search scopes by disabling ops feature flags.
What Is IFilter?
When Microsoft created the Windows Search feature that allows you to search through files in Windows Explorer, Microsoft also created a system that allows 3rd party developers to add support for additional file formats. This system is known by its technical name IFilter. If a company creates a proprietary file format, they can provide an IFilter that their customers can install. Then Windows Search can search through the text in files saved in that company’s proprietary format.
Using IFilter with PowerGREP
PowerGREP can use any IFilter that you have installed on your computer. You can tell PowerGREP for exactly which file types you want to use IFilter and/or for exactly which file types you don’t want to use IFilter. You can do so by clicking the (. ) button next to “file formats to search inside” in the File Selector. By default, the configurations that tell PowerGREP to search through files in proprietary formats enable the IFilter for PowerPoint files and OpenOffice files other than OpenOffice Writer. PowerGREP does not yet have built-in decoders for these formats. Using the IFilter for these formats at least allows you to search through them.
PowerGREP does not have any control over the way the IFilters installed on your computer work. It can only choose to use them or not. Some IFilters definitely work better than others. Many just extract the text from the file, without any spacing or formatting. This is fine for Windows Search, which just uses the text to build a keyword index. But in PowerGREP, which can display match context and even entire files, an IFilter’s conversion can look like a monolithic blob of text that’s hard to read.
Since Windows Search can only search through files, Microsoft made the IFilter system read-only. If you configure PowerGREP to use IFilter for certain file types then PowerGREP cannot make changes to those files. But PowerGREP can use all its regular expressions and other capabilities on files decoded with IFilter.
So it’s best to only use the IFilter system for files that aren’t plain text and that PowerGREP doesn’t have a built-in decoder for.
See PowerGREP in Action
There are four ways to see PowerGREP in action:
- Just sit back and watch the videos in your web browser.
- Take a closer look at the screen shots.
- Download the free evaluation version, which comes with full documentation.
- Buy PowerGREP now and try it risk-free with our 3-month unconditional money-back guarantee.
Whoomp! There it is.
By David Nield | Published Oct 25, 2019 1:43 PM
Keeping your files in an online cloud locker means you can free up some space on your computer and get at your files from anywhere, using any device. But if you haven’t taken the time to explore a platform in depth, or if you use several and often get confused, you might find it harder to track down particular files compared to having them on a local hard drive.
It doesn’t have to be this way, though. All the big cloud storage providers have useful tools for searching through your files and folders, whether you’re using a web browser, a desktop computer, or your phone.
Find files in Dropbox
Load up the Dropbox website, and you’ll see a deceptively simple-looking search box up in the top right-hand corner. There, type the name or part of the name of a file to start looking for it. A filter list appears on the right, so you can limit your search to specific document types and formats, like whether it’s an audio or video file.
You can also use the folder drop-down list on the right to limit your search to specific folders. If you’re on a paid-for plan, Dropbox will also show matches for text inside files, so if you can’t remember a file name, you’ll be able to find it using some keywords. You can use wildcards, too, so you can run searches for *.mp3 for all the files with an MP3 extension, for example; or *.docx to look for all your Word documents.
Unfortunately, you can’t limit your search to a particular date range, but you can click the Relevance column heading and change this to Last modified—this will show you the most recently edited or created files first. If you want to see the oldest files at the top, click the heading again and Dropbox will automatically sort them for you.
The search boxes in the mobile and desktop apps work in a similar way, though you don’t get as many filtering options. You can still type out words or phrases you’re looking for in filenames and inside the files themselves (if you’re on a paid-for plan), and use the asterisk wildcard (*.mp3, *.docx, etc.) to search for particular types of files.
Find files in Google Drive
You would expect Google products to come with a good search function, and that’s exactly the case with its cloud storage platform. At the top of the Google Drive web interface there is a large search box—results will include file names and documents that contain the words you used. As you type, relevant matches will appear. You can click on any of these to open a file, or hit Enter to see a full list of results.
The files will be listed by relevance—how well they match the words you searched for. To sort by date, click the Last modified link at the top, then choose Last modified. A new arrow icon will appear so you can toggle between seeing the newest files or the oldest files at the top of the list.
To look for a particular type of file, click inside the search box without typing anything, then choose an option from the list (like Spreadsheets or Videos), and then add some keywords if needed. Select More search tools or Advanced Search (depending if you have a personal or a company account) at the bottom of the list of file types to narrow down your search by a custom time frame, by the owner of the file (if it’s shared), or by a particular folder location.
Most of these options are available in the Google Drive app on mobile as well—just tap in the search box at the top to get started. If you can though, it’s easier to use the web interface on the desktop, since some search options (such as searching inside a custom time frame) are not available in mobile.
Find files in iCloud
Apple only makes a minimal effort with iCloud Drive on the web and on Windows, so if you need to search through files on this service, we’d recommend heading to an Apple device to do the searching.
On macOS, open up Finder, then choose iCloud Drive from the navigation options on the left (if you can’t see it, choose View then Show Sidebar). Type your search terms, like a filename or a file type, into the search box in the top right-hand corner. In the results screen, click Date Last Opened to switch between seeing the oldest or the newest files first.
Various options appear under the search box as you type. Enter “jpg” for example, and you can choose whether to look for files with “jpg” in the name, or for JPEG images. Use the small Plus icon below the search box to add more filters, such as the date files were created, or something you’re looking for in a file’s contents.
The iCloud Drive search on iOS and iPadOS isn’t as advanced, but it’s there if you need it. Open up the Files app, switch to the Browse tab, and enter your terms into the search box at the top, making sure iCloud Drive is selected as the location. Again, if you enter a file extension (like “jpg” or “docx”) the system will ask you if you want to look for files of that type.
Find files in OneDrive
Your OneDrive locker on the web has a Search everything box up in the top left corner. Click inside this box, then start typing to run a search. You’ll see suggested matches as you type—you can click on those, or you can select See more results to see a full list.
OneDrive searches on filenames and inside documents too, like plain text files, PDFs, and Word files. Use the Type and Date drop-down menus at the top to limit the results by file type and date respectively (you can choose to only see matching photos from the last week, for example).
Of course you can also search through your OneDrive in Windows, as the two Microsoft products are tightly integrated. From File Explorer, choose OneDrive from the panel on the left (select View then Navigation pane if you can’t see it), enter your keywords into the Search OneDrive box in the top right corner, and results will pop up on screen. You’ll also see various options appear on the Search menu at the top, enabling you to filter results by file type, size, and the date they were last modified.
You can also run wildcard searches with an asterisk, like *.jpg to find JPEG files and *.docx to find Word documents. These wildcard searches work in the OneDrive mobile apps as well, although you don’t get many other options on your phone. From the front screen, tap the Search icon (top right) to run a query.
David Nield is a tech journalist from the UK who has been writing about gadgets and apps since way before the iPhone and Twitter were invented. When he’s not busy doing that, he usually takes breaks from all things tech with long walks in the countryside.
I want to find a text file in my hard disk which contains a specific word.
Prior to Ubuntu 12.4 I used to start in the dash an application, I think it was called “Search for file. “, whose icon was a magnifying glass.I can’t find that simple application any more.
7 Answers 7
You can use the grep command from terminal:
This command will find all occurrences of “word” in all the files under the current directory (or subdrectories).
Open Search for files select Select More Options and
Here’s an overview of different methods that one can use for searching files for specific strings of text, with a few options added specifically to work only with text files, and ignore binary/application files.
One should note,however,that searching for word can get a little complex, because most line-matching tools will try to find a word anywhere on the line. If we’re talking about a word as string that could appear in the beginning or end of line, or alone on the line, or surrounded by spaces and/or punctuation – that’s when we’ll need regular expressions, and especially those that come from Perl. Here, for example, we can use -P in grep to make use of Perl regular expressions to surround it.
- -r for recursive search down from current directory
- -I to ignore binary files
- -H to output filename where match is found
Suitable for searching only.
find + grep
- find does the recursive search part
- -I option is to ignore binary files
- -H to output filename where line is found
good approach for combining with other commands within subshell, like:
poor-mans recursive grep in recursive bash script
This is the “bash way”. Not ideal, probably no good reason to use this when you have grep or perl installed.
In Windows, the primary way of interacting with files and folders is through the File Explorer application. (In older versions of Windows, this may be called Windows Explorer. In Macs, the equivalent would be Finder.)
There are a couple of ways to open File Explorer. The shortcut Win+E will open File Explorer. It can also be opened by clicking the Start button and typing “File Explorer” or by right-clicking any folder and selecting Open. By default, File Explorer is pinned to the task bar (see below), and it can be opened from there.
Open the Start menu and type “File Explorer.”
Find File Explorer pinned to the taskbar.
Right-click a folder and select Open.
Some folders already exist in File Explorer, such as Documents, Desktop, and Downloads. (Documents may be called “My Documents” in older versions of Windows). You can create more folders or folders within folders to allow for better organization.
To create a folder, right-click, then select New>Folder.
Right-click in File Explorer, then select New>Folder.
In Windows 7, there is a New folder button near the top of the window. In Windows 10, you can also click the Home tab, then the New Folder button.
Windows 7 New folder button
Windows 10 New folder button
To rename a file or folder, right-click the file or folder, then select Rename.
You can also click the name of the file or folder once, wait one second, then click the name of the file or folder again.
Note that in Windows, a file cannot contain any of the following characters: \ / : * ? ” | . This is because those characters have special meaning in Windows. (For example \ is included in file paths.) If Windows encounters a file or folder with those symbols, it could potentially misread the file or folder name and cause problems. As a precaution, Windows will not let you save files or folders with those characters, so don’t worry about saving a file with those characters in the name by mistake.
Macs are less stringent about what characters can be included in a file or folder’s name; only the colon (:) cannot be used. However, it is a good practice to avoid using the Windows-prohibited characters in file names because the file name will be automatically changed when moved to a Windows computer.