In this part, we learn one of the most powerful Linux skills — searching text inside files and command output. This is where Linux becomes dangerous (in a good way).
grep searches for matching text patterns.
It is used everywhere: logs, configs, scripts, pipelines.
grep "error" file.txt
This prints all lines containing the word error.
Linux is case-sensitive by default.
Use -i to ignore case.
grep -i "error" file.txt
grep "failed" *.log
This searches across all log files.
Search inside directories using -r.
grep -r "password" /etc
Recursive grep can be heavy. Use it carefully on large directories.
grep -n "listen" nginx.conf
Shows exact line number — critical for debugging.
Pipes send output of one command into another.
ls -l | grep ".log"
This filters only log files from directory listing.
Find running processes:
ps aux | grep nginx
Use -v to exclude matching lines.
ps aux | grep -v grep
grep -i "error" /var/log/syslog
System admins live inside commands like this.
Linux tools are simple alone, unstoppable when combined.
If you master grep and pipes, you control text — and Linux is mostly text.
In the next part, we will learn about file permissions and ownership — the most misunderstood Linux concept.
Next: File Permissions & Ownership →