grep
Search text with regular expressions.
KaliParrotLinuxpassive
pkg: grep
grep filters lines matching a pattern — the workhorse for sifting logs, output and large files.
Syntax
grep [-rinE] {pattern} [files]
Example
grep -rinE "password|secret|api[_-]?key" .
Recursively, case-insensitively hunts source for hard-coded secrets.
Options & flags
What each switch does. Toggle them in the builder below to assemble a command.
Command builder
Tick options (and fill any values) to build a ready-to-copy command.
grep
Usage examples
grep -rinE "password|secret" .
Recursively hunt for hard-coded secrets.
grep -o "[0-9.]\{7,\}" file
Extract IP-like strings.
Advantages
- Fast and ubiquitous
- Powerful regex + recursion
- Pipes into everything
Disadvantages
- Regex pitfalls for beginners
- Line-oriented (no structure)
- Binary files need -a
Tags
#text#search#logs
Official docs: GNU grep ↗
Related commands
Frequently asked questions
What is grep used for?
grep filters lines matching a pattern — the workhorse for sifting logs, output and large files.
What is an example grep command?
A common example is: grep -rinE "password|secret|api[_-]?key" . — Recursively, case-insensitively hunts source for hard-coded secrets.
Is grep part of Kali Linux?
Yes. grep ships with Kali Linux (and Parrot OS). If missing, install it with: sudo apt install grep.
What category of security tool is grep?
grep is a Core Linux tool with a passive-risk profile when run against a live target.
Try recon tools live
Run real scans against a domain you control, stage by stage.