#45 Shorticles: From Beginner to DevOps-Ready: Linux Commands, grep–sed–awk, wc & Real Log Analysis…
If you’re preparing for DevOps, AWS, or backend engineering interviews, strong Linux command-line skills are essential. In real production…
#45 Shorticles: From Beginner to DevOps-Ready: Linux Commands, grep–sed–awk, wc & Real Log Analysis (With Practical Examples)
If you’re preparing for DevOps, AWS, or backend engineering interviews, strong Linux command-line skills are essential. In real production systems, troubleshooting starts with logs, terminals, and fast text processing — not dashboards.
This guide explains everything with clear real-world examples so you can move from beginner → interview-ready.
Core Linux Commands Every DevOps Engineer Uses
File & directory operations
Commands:
ls, cd, pwd, mkdir, cp, mv, rm, find
Examples
Find latest log files:
ls -lrt /var/log
Create and move files:
mkdir test
cp app.log test/
mv app.log old_app.log
Search for large files:
find /var/log -type f -size +100M
Dangerous command:
rm -rf folder_name
Deletes permanently — use carefully in production.
Viewing & Monitoring Files (Real Debugging Tools)
Commands:
cat, less, head, tail, tail -f
Examples
View first 20 lines:
head -n 20 app.log
View last 50 lines:
tail -n 50 app.log
Live production monitoring:
tail -f app.log
➡ Most used DevOps command during incidents.
Text Processing Toolkit (Most Important Interview Area)
grep → search text
Ignore case:
grep -i "error" app.log
Recursive search with line numbers:
grep -rin "exception" .
Live error monitoring:
tail -f app.log | grep -i error
sed → modify text stream
Replace text:
sed 's/error/ERROR/g' file.txt
Delete line 5:
sed '5d' file.txt
Environment change example:
sed 's/dev/prod/g' config.txt
awk → analyze columns & patterns
Print first column (e.g., IP):
awk '{print $1}' access.log
Print IP and status code:
awk '{print $1, $9}' access.log
Sum numeric column:
awk '{sum += $1} END {print sum}' numbers.txt
sort, uniq, wc — Counting & Aggregation
sort
Numeric descending:
sort -nr numbers.txt
uniq
Remove duplicates:
sort file.txt | uniq
Count duplicates:
sort file.txt | uniq -c
wc → word/line/byte count
Count lines:
wc -l app.log
Count words:
wc -w file.txt
Count characters:
wc -m file.txt
Real DevOps example:
grep -i error app.log | wc -l
➡ Total error occurrences in logs.
System, Disk & Process Troubleshooting
Processes
ps -ef
top
kill -9 PID
systemctl status nginx
Disk & memory
df -h
du -sh /var/log
free -m
uptime
Used to diagnose: • High CPU • Memory leaks • Disk-full crashes • Stuck services
Networking Commands DevOps Engineers Use Daily
netstat -tulnp
ss -tulnp
curl http://service:8080/health
wget http://file.zip
ping google.com
Health check example:
curl http://localhost:8080/actuator/health
grep vs sed vs awk — The Classic Interview Question
One-line memory trick:
grep → search sed → modify awk → analyze
Same log, three tools:
Search errors:
grep "ERROR" app.log
Replace text:
sed 's/ERROR/WARN/g' app.log
Extract columns:
awk '{print $1, $2}' app.log
Remembering this difference answers a very common DevOps interview question.
Real Log-Analysis Interview Scenarios
Count total errors
grep -i error app.log | wc -l
Show last 20 errors
tail -n 200 app.log | grep -i error | tail -20
List unique client IPs
awk '{print $1}' access.log | sort | uniq
Top 10 most frequent IPs (VERY COMMON)
awk '{print $1}' access.log | sort | uniq -c | sort -nr | head
Monitor live production errors
tail -f app.log | grep -i error
Final Interview Mindset
When asked:
“Production issue — how will you debug logs?”
A strong DevOps answer follows this flow:
tail -f → watch live logs
grep → filter errors
awk → analyze patterns
wc -l → count impact
sort | uniq -c → find top offenders
This shows real production troubleshooting thinking, not just theory.
Closing Thoughts
Linux mastery isn’t about memorizing commands — it’s about thinking like a production engineer:
• Observe quickly • Filter intelligently • Analyze efficiently • Fix confidently
If you’re moving toward DevOps, Cloud, or AI-driven infrastructure roles, these command-line skills form your strongest technical foundation.
메타데이터
- post_id
- 7bbd48868be1
- slug
- 45-shorticles-from-beginner-to-devops-ready-linux-commands-grep-sed-awk-wc-real-log-analysis-7bbd48868be1
- url
- https://medium.com/@rohitshrivastava87/45-shorticles-from-beginner-to-devops-ready-linux-commands-grep-sed-awk-wc-real-log-analysis-7bbd48868be1
- canonical_url
- https://medium.com/@rohitshrivastava87/45-shorticles-from-beginner-to-devops-ready-linux-commands-grep-sed-awk-wc-real-log-analysis-7bbd48868be1
- author_url
- https://medium.com/@rohitshrivastava87
- status
- ok
- fetched_at
- 2026-06-09 14:34:10