Search text inside files quickly from the command line and turn patterns into action. 16.11.2025 | reading time: 3 min The `grep` command searches for patterns inside files and streams, making it the first tool to reach for when he needs to find a string across many files; this short guide shows how to use it on real tasks and in pipelines. Find TODOs in a project Case: he maintains a codebase and must list every TODO comment. Run a recursive search and show line numbers: ```bash $ grep -n "TODO" -R src/ src/main.c:42: // TODO: handle overflow src/utils.c:88: // TODO: add tests ``` This finds matches across files and prints filename:line:numbered context so he can jump straight to the right spot. Options that make a difference Key switches: `-R` or `-r` for recursive directories, `-n` to show line numbers, `-i` for case-insensitive matches, `-E` for extended regular expressions, `-F` for fixed-string fast searches, `-w` to match whole words, `-v` to invert matches, `-l` to list filenames only and `-o` to print only the matched parts; combine these to tune speed and output for scripts or human inspection. Practical pipelines and examples He often pairs `grep` with pipes and utilities: filter live logs with `tail -f | grep --color`, find files then search with `find . -type f -name "*.conf" -print0 | xargs -0 grep -n "pattern"`, or extract fields then pass results to `awk` or `sed` for transformation; these combinations turn a text match into automated fixes. When to choose other search tools For very large repositories or complex regexes, modern tools like ripgrep often outpace `grep` while `ack` and `the_silver_searcher` add project-aware defaults; still, `grep` is ubiquitous and integrates with POSIX pipelines, making it essential in scripts and recovery scenarios. Next steps and study Start practicing on real directories, write small scripts that parse `grep` output, and add colorized patterns to your shell; mastering `grep` unlocks efficient troubleshooting and prepares him for more advanced text processing, which is useful for certification paths like CompTIA Linux+ or LPIC-1 and exam-focused courses such as bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities filesystem scripting