Back to Blog
Arnošt Havelka

Findstr Command

Advanced text search with regular expressions.

Start Interactive Lesson
Findstr Command

findstr is the big brother of find. It supports regular expressions (regex), searches recursively across directories, and offers more powerful filtering options. It is comparable to grep in Linux.

Try the command

Search recursively for a pattern!

Build the command
findstr
/nPrints the line number before each line that matches.
Terminal
C:\Users\User>findstr /s "error" *.txt

Common Options

Real-World Examples

1. Finding files containing "TODO" in an entire project

Search every .js file in the current folder and subfolders.

Command Prompt
C:\Users\User>findstr /s /n "TODO" *.js

2. Using Regex to find numbers

Find lines that start with a number.

Command Prompt
C:\Users\User>findstr /r "^[0-9]" data.txt

3. Searching for multiple strings

Find lines containing either "Error" or "Warning".

Command Prompt
C:\Users\User>findstr "Error Warning" app.log

Knowledge Check

1 / 3

Which flag enables recursive search in subdirectories?

References

These documentation links provide authoritative details for the commands used in this article.