0.4 How each chapter is written
Why: the problem
Most students read a DevOps page like a novel. They read the commands, nod, and move on. A week later they cannot run a single one. DevOps is learned with the hands, like driving. At companies like Wipro, new engineers are given a lab and a checklist, not a book. Every chapter in this course is written so you can do the same at home. Each lesson starts with Why (the problem), then What (the words), then How (the exact commands with their output). Then come full examples, a Verify part, red errors with fixes, Cleanup, practice tasks, homework, FAQ, interview questions and a quiz. In this lesson you will learn how to use that shape well: keep a notes repo, compare your output with the green output, read red errors calmly, and clean up so labs do not cost money.
What we will build
You will set up your own learning kit: a Git repo for notes, a way to save the output of every lab, a quick way to compare your output with the page, and a habit of reading red errors line by line. You will practise it on a tiny lab right now.
What: every term in plain English
- Green output — The output you should see when the step works.
- Red output — An error message. It is a clue, not a disaster.
- Verify — Commands that prove the lab really worked.
- Cleanup — Commands that delete what you made, so nothing keeps running or costing money.
- Notes repo — A Git folder where you keep your own notes and outputs.
- tee — A command that shows output on screen and saves it to a file at the same time.
- diff — A command that shows the differences between two files.
- Exit code — A number a command returns. 0 means success, anything else means failure.
How: step by step
-
Create your notes repo
mkdir -p ~/devops-lab/notes && cd ~/devops-lab/notes && git init -q && echo "# My DevOps notes" > README.md && git add . && git commit -qm "start notes" && git log --onelineWhat it does: A private Git repo for everything you learn.
Output
b31f0a2 start notes -
Save a lab output while you see it
uname -a | tee ch0-uname.txtWhat it does: tee prints the output and also saves it to a file.
Output
Linux lab 5.15.0-119-generic #129-Ubuntu SMP x86_64 GNU/Linux -
Check the exit code
ls /etc/hostname; echo "exit=$?" ls /nope; echo "exit=$?"What it does: $? holds the exit code of the last command.
Output
/etc/hostname exit=0 ls: cannot access '/nope': No such file or directory exit=2 -
Compare with the page
echo "Hello from Docker!" > expected.txt docker run --rm hello-world | head -2 | tail -1 > mine.txt diff expected.txt mine.txt && echo SAMEWhat it does: diff prints nothing and SAME when both match.
Output
SAME -
Commit your evidence
git add . && git commit -qm "ch0 outputs" && git log --oneline | head -2What it does: Your notes repo now proves what you did.
Output
c9d2e11 ch0 outputs b31f0a2 start notes
Example 1: A note template you copy for every lesson
Stack. Markdown, VS Code
Goal. A note template you copy for every lesson.
template.md
# Lesson X.Y: title
## Why (one line, my words)
## Commands I ran
(paste the commands you typed, indented 4 spaces)
## Green output I got
(paste the output, indented 4 spaces)
## Red error I hit and the fix
## One interview answer (60 seconds)
terminal
cp template.md 0.4.md
code 0.4.md
What each line does
# Lesson X.Y: title— Keep the same numbers as the course, so you can find things later.## Why— One line in your own words. If you cannot write it, read the Why part again.## Commands I ran— Real commands you typed, not copied from the page.## Red error— The best part of your notes. Errors repeat in jobs.## One interview answer— Practise speaking the lesson.
Green output
$ ls
0.4.md README.md ch0-uname.txt expected.txt mine.txt template.md
Expected result. Every lesson gets one small file in the same shape. After 70 chapters you have your own DevOps handbook.
Example 2: Record a whole lab session to a file with the script command
Stack. util-linux script, Docker
Goal. Record a whole lab session to a file with the script command.
terminal
script -q ~/devops-lab/notes/session-0.4.log
docker run --rm alpine:3.20 echo "inside a container"
docker run --rm alpine:3.20 cat /etc/os-release | head -2
exit
grep -n "inside" ~/devops-lab/notes/session-0.4.log
What each line does
script -q FILE— Starts recording everything you type and see into FILE.docker run --rm alpine:3.20 echo— Runs one command in a tiny Alpine container and deletes it.exit— Stops the recording.grep -n "inside"— Finds the line in your recording.
Green output
inside a container
NAME="Alpine Linux"
VERSION_ID=3.20.3
Script done.
2:inside a container
Expected result. You have a full record of the lab. When something breaks later, you can see exactly what you typed.
Example 3: Read a red error line by line, the calm way
Stack. Docker 26
Goal. Read a red error line by line, the calm way.
terminal
docker run --rm -p 80:80 nginx:1.27 &
sleep 2
docker run --rm -p 80:80 nginx:1.27
What each line does
&— Runs the first container in the background.second docker run— Tries to use port 80 again, so it fails on purpose.Read the last line first— The last line usually holds the real reason.Look for a key phrase— Here it is "port is already allocated".Search your notes first— Then the docs. Then the web.
Green output
docker: Error response from daemon: driver failed programming external connectivity on endpoint
...: Bind for 0.0.0.0:80 failed: port is already allocated.
Expected result. You found the cause in one line: port 80 is busy. The fix is to stop the first container or use another port like -p 8080:80.
Verify: did it work?
-
Check your notes repo is clean
git status --shortWhat it does: No output means everything is committed.
Output
(no output means it worked) -
Count your evidence files
ls | wc -lWhat it does: You should have several files from this lesson.
Output
7
When it is red 1
fatal: not a git repository (or any of the parent directories): .git
Cause. You ran git outside your notes folder.
Fix, step by step
- Run pwd to see where you are.
- cd ~/devops-lab/notes.
- Run the git command again.
When it is red 2
Please tell me who you are. Run git config --global user.email ...
Cause. Git does not know your name and email yet.
Fix, step by step
- Run git config --global user.name "Your Name".
- Run git config --global user.email "you@example.com".
- Commit again.
When it is red 3
script: command not found
Cause. The util-linux package is missing (rare on Ubuntu).
Fix, step by step
- Run sudo apt install -y util-linux.
- Run script again.
Cleanup
-
Stop the background nginx
docker ps -q --filter ancestor=nginx:1.27 | xargs -r docker rm -fWhat it does: Finds and removes the nginx container from the red error example.
Output
5b1c0e... -
Remove scratch files
rm -f ~/devops-lab/notes/expected.txt ~/devops-lab/notes/mine.txtWhat it does: Keeps notes, deletes test files.
Output
(no output means it worked)
Ravindra Bagale's Tip
Do not only read. Type. If a red error appears, do not panic. Read the last line first. Commit your notes repo every day!
फक्त वाचू नका, टाइप करा. लाल error आला तर घाबरू नका, शेवटची line आधी वाचा. Notes repo रोज commit करा!
सिर्फ मत पढ़ो, टाइप करो. लाल error आए तो घबराओ मत, आखिरी line पहले पढ़ो. Notes repo रोज़ commit करो!
Practice tasks
Easy Use the template
Why: Same shape every time saves thinking.
What to do: Make 0.4.md from the template and fill it.
- cp template.md 0.4.md
- Fill every heading.
Check: All five headings have text.
Medium Collect three red errors
Why: Errors are the real teachers.
What to do: Cause three different errors on purpose and note each fix.
- Wrong command name.
- Wrong file path.
- Port already used.
Check: Three errors with fixes in your notes.
Hard Write a checker
Why: Comparing by eye is slow.
What to do: Write check.sh that runs a command and compares it with an expected file.
- Use diff -q.
- Print PASS or FAIL.
Check: check.sh prints PASS for a correct output.
Easy Say How each chapter is written in two lines
Why: If you can say it simply, you understand it. Interviewers want the short version first.
What to do: Write two short lines about How each chapter is written for a friend who is new to IT.
- Write what problem it solves.
- Write one command or file you used for it.
- Read it aloud.
Check: Your friend understands it without asking a question.
Easy Run the commands again from memory
Why: Typing from memory makes the commands stick. Copy-paste does not.
What to do: Close this page and run the main steps of this lesson again.
- Open a fresh terminal.
- Type each command yourself.
- Open the page only when stuck.
Check: You got the same green output without copying.
Medium Break it on purpose
Why: You must know the red message by face. In a real job there is no time to read slowly.
What to do: Cause one error from the "When it is red" part of this lesson and fix it.
- Follow one error section.
- Copy the exact message into your notes.
- Write the fix in one line.
Check: You fixed it using only your notes.
Medium Write a one-page note
Why: A short note in your own words is the best revision.
What to do: Write a note page for this lesson in ~/devops-lab/notes.md.
- Title, why, the commands, one error and its fix.
Check: A classmate can follow your note alone.
Hard Explain it like an interview
Why: Interviewers want real stories, not definitions.
What to do: Record a 60 second answer about this lesson on your phone.
- Say the problem, what you did, the command you ran, and one error you hit.
Check: Your answer has a real command and a real error message.
Hard Draw the flow top to bottom
Why: A drawing shows the order of things.
What to do: Draw this lesson as boxes from top to bottom on paper.
- One box per step.
- Write the command next to each box.
Check: Each box matches a step you really ran.
Easy Teach it to someone
Why: Teaching shows the gaps in your own understanding.
What to do: Explain this lesson to a friend or family member in five minutes.
- Use one real app as the example (Swiggy, Netflix, Paytm).
Check: They can tell you back the main idea.
Homework: try at home
Try at home
At home, pick any lesson you already read in the AWS course. Redo it with your new kit: note file from the template, outputs saved with tee, one red error written down, and a commit at the end.
Recap
- Every lesson has Why, What, How, Examples, Verify, Red, Cleanup, Tasks.
- Type commands yourself and compare with the green output.
- Save outputs with tee or script.
- Read red errors from the last line.
- Keep a notes repo and always clean up.
FAQ
Can I just read and not type?
You will forget in a week. Type at least the main steps.
What if my output is a little different?
Versions, names and IDs change. Check the important part, like Running or 200.
Should I copy errors into my notes?
Yes. Errors repeat at work, and your notes will save you.
Is a private notes repo enough?
Yes. Keep it private; never put keys or passwords in it.
How long should one lesson take?
About 45 to 90 minutes with the labs.
Interview questions
-
How do you troubleshoot an unknown error?
Read the last line, find the key phrase, check logs and recent changes, reproduce it, then fix one thing at a time.
-
What is an exit code?
A number a process returns. 0 is success. CI tools fail a step when the exit code is not 0.
-
How do you keep a record of what you did on a server?
Shell history, script recordings, and runbooks in Git.
-
Why is cleanup important in the cloud?
Running resources cost money and can be a security risk.
-
How do you compare expected and actual output?
With diff, or with tests that assert the expected value.
Quick quiz
Q1. What should you read first in a long error?
The last line, where the real reason usually is.
Q2. What does tee do?
Shows output on screen and saves it to a file.
Q3. What exit code means success?
0.
Q4. Why keep a notes repo in Git?
You keep every version and can see your progress.
Q5. Why does every lesson have a Cleanup part?
So nothing keeps running and costing money.
Did you understand? Let us try it once more.