grep Basics
Searching with grep
grep searches for patterns in files. It's one of the most powerful and frequently used Linux commands.bash
# Search for a word in a file
grep "error" logfile.txt
# Case-insensitive search
grep -i "error" logfile.txt
# Search recursively in directories
grep -r "TODO" ./src/
# Show line numbers
grep -n "function" script.js
# Count matches
grep -c "warning" logfile.txtTip:grep supports regular expressions. Use grep -E for extended regex (same as egrep).
Terminalbash
Welcome to the Linux Terminal Simulator!
Type commands below. Use 'help' to see available commands.
Try: