← All commands
Topic hub Text Processing
Windows Linux Text Processing Search

Windows findstr equivalent in Linux

Searches for text patterns inside files. One of the most-used Linux commands.

Windows findstr
Linux equivalents
Debian/Ubuntu same command
grep
Fedora same command
grep
Arch same command
grep

Overview

What this command does

Searches for text patterns inside files. One of the most-used Linux commands.

Migration tip: grep supports regular expressions, making it far more powerful than Windows' findstr. The pipe operator | lets you chain it with other commands.

Practical tasks

Common use cases

Search text within files

Searches for text patterns inside files. One of the most-used Linux commands.

grep -r

Search recursively in all files

grep -i

Case-insensitive search

grep -n

Show line numbers

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

grep "error" logfile.txt
grep -i "error" logfile.txt
grep -rn "TODO" ~/Projects/
ps aux | grep nginx
cat access.log | grep "404"

Walkthrough

Examples with explanations

# Windows: findstr "error" logfile.txt
grep "error" logfile.txt           # search for 'error'
grep -i "error" logfile.txt        # case-insensitive
grep -rn "TODO" ~/Projects/       # find TODOs in all files

# Super useful: pipe into grep:
ps aux | grep nginx              # find nginx process
cat access.log | grep "404"     # find all 404 errors

Reference

Common options and variations

Command or optionUse
grep -rSearch recursively in all files
grep -iCase-insensitive search
grep -nShow line numbers
grep -vShow lines that do NOT match
grep -cCount matching lines only
grep -lShow only filenames that match

Distro differences

Debian/Ubuntu vs Fedora vs Arch

This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command grep Same command on this distribution.
Fedora same command grep Same command on this distribution.
Arch same command grep Same command on this distribution.

Keep learning

Related Text Processing commands