VS Code Search All Files: How To
In this article
Yes, VS Code can search all files in your workspace by default using the global search feature (Ctrl+Shift+F on Windows/Linux, Cmd+Shift+F on macOS). It scans every file in the currently opened folder, excluding those matched by your files.exclude and search.exclude settings, and shows results grouped by file with the matching lines highlighted.
What the Global Search Does
The global search is the primary way to find text across an entire project. It opens in the Side Bar and provides a single input box for your query. As you type, results appear in real time, grouped by file path. Each result shows the line number and a snippet of the matching line. Clicking any result opens that file at the exact line. This works for any text-based file, including source code, Markdown, JSON, and plain text.
How to Open and Use It
- Press Ctrl+Shift+F (Windows/Linux) or Cmd+Shift+F (macOS).
- Type your search term in the input box at the top of the Side Bar.
- Press Enter to run the search. Results appear below.
- Use the arrow buttons in the search bar to cycle through matches, or click any result directly.
You can also open it from the View menu: View → Search. The search box supports regular expressions (regex) by toggling the .* icon. To limit the search to a specific subfolder, right-click that folder in the Explorer and choose Find in Folder.
Search Options and Filters
Below the input box, several toggles refine your search:
- Match Case – makes the search case-sensitive.
- Match Whole Word – finds only whole words, not substrings.
- Use Regular Expression – enables regex patterns.
- Files to Include – a glob pattern like
*.jsto limit to certain file types. - Files to Exclude – a glob pattern to skip certain files or folders.
These filters are especially useful when you know the file type or want to avoid searching generated files.
Common Problems and Fixes
If the search seems to miss files, check the following:
- Excluded folders: By default, VS Code excludes
node_modules,dist, and.gitfrom search. You can change this in settings undersearch.exclude. - Large files: Files over a certain size (default 100 MB) are skipped. Adjust
search.maxFileSizeif needed. - Binary files: Binary files are not searched by default. You can enable
search.useIgnoreFilesandsearch.searchOnDiskif needed. - Workspace vs folder: If you opened a single file rather than a folder, global search won't work. Use File → Open Folder to open the project root.
Comparing with Other Editors
VS Code's global search is fast and integrated, but it's not the only option. Sublime Text and Notepad++ also offer powerful find-in-files features. However, VS Code's advantage is its tight integration with the editor: you can preview results, replace across files, and use regex without leaving the interface. For very large codebases, tools like ripgrep (which VS Code uses under the hood) are faster, but VS Code's UI is more accessible for most users.
Cost and Availability
VS Code is free and open-source, available for Windows, macOS, and Linux. The global search feature is included with no additional cost. There are no premium tiers or licensing fees for using the search functionality.
Safety and Privacy
VS Code's search runs entirely locally on your machine. No data is sent to Microsoft or any third party. Your files are never uploaded unless you explicitly use a remote extension or cloud service. This makes it safe for sensitive codebases.
Alternatives for Advanced Searching
If you need more advanced search capabilities, consider:
- Ripgrep – the command-line tool that powers VS Code's search. It's extremely fast and supports complex regex.
- grep – the classic Unix tool, available on all platforms.
- Search extensions – VS Code marketplace offers extensions like “Search Editor” or “Advanced Search” that add extra features like multi-term search.
These tools are useful when you need to search across many projects or want to script searches.
Frequently Asked Questions
Why doesn't VS Code search find files in node_modules?
By default, VS Code excludes node_modules from search to keep results fast and relevant. You can change this by adding "**/node_modules" to the search.exclude setting, or by using the Files to Include box with a pattern like **/*.js.
Can I search all files in a specific folder only?
Yes. Right-click a folder in the Explorer and select Find in Folder. This opens the global search with that folder pre-filled in the Files to Include box, limiting results to that folder.
How do I replace text across all files?
Open the global search, enter your search term, then click the arrow next to the search box to expand the replace field. Type the replacement text and click the Replace All button. Be careful, as this changes all matching occurrences in the workspace.
Does VS Code search inside binary files?
No, by default binary files are not searched. You can enable searching them by setting search.searchOnDisk to true and adjusting search.maxFileSize, but results may be noisy and performance may suffer.
Can I search using regular expressions?
Yes, toggle the .* icon in the search box to enable regex. You can use standard regex patterns like \d+ for digits or ^import for lines starting with “import”.