Fast Ways to Locate Text in Files Using Terminal or VS Code
The easiest way is to search inside files by content. Here are the quickest methods depending on what you’re using:
Linux / macOS (Terminal)
Use grep:
grep -R --include="*.txt" --include="*.md" "Posts in category:" .
What it does:
-Rsearches recursively in the folder--includelimits the search to.txtand.mdfiles"Posts in category:"is the text you’re looking for.means the current folder
It will print the filename where the text exists.
If you only want filenames:
grep -Rl --include="*.txt" --include="*.md" "Posts in category:" .
Windows (PowerShell)
Select-String -Path *.txt, *.md -Pattern "Posts in category:" -List
This shows which file contains that text.
VS Code
- Open the folder in VS Code
- Press Ctrl + Shift + F
- Search:
Posts in category:
- Filter files:
*.txt, *.md