Shell Basics · 8 min read · Beginner
Pipes, Redirection & Text Search (grep)
Chain small Unix tools with pipes (|), redirect output (> and >>), and filter logs cleanly with grep, sort, and wc.
What you'll learn
- Send one command's stdout into another command's stdin with |
- Distinguish overwrite (>) from append (>>)
- Search logs and codebases with grep -i and count matches with wc -l
The Unix philosophy is “do one thing well, and compose tools with pipes (|)”. Instead of writing a 50-line script, a one-line pipeline like grep "ERROR" app.log | sort | uniq -c | wc -l summarizes gigabytes of logs instantaneously.
Fill-in-the-Blank Exercise
Filter & Count Log Errors
Search for 'ERROR' in server.log and pipe into wc -l to count matching lines.
"ERROR" server.log wc -lLive Bash Lab
Bashpipes.sh
Expected OutputClick “Run Live” to compile with GNU Bash
2
Check Your Understanding
Score: 0 / 1
1. What is the difference between > and >> in Bash?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.