Ravindra BagaleCourses & study guides मराठी

How to Read This Course

DevOps

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.
Create your notes repo Save a lab output while you see it Check the exit code Compare with the page Commit your evidence
How to work through a lesson: run, compare, note, clean

How: step by step

  1. 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 --oneline
    

    What it does: A private Git repo for everything you learn.

    Output

    b31f0a2 start notes
    
  2. Save a lab output while you see it

    uname -a | tee ch0-uname.txt
    

    What 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
    
  3. 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
    
  4. 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 SAME
    

    What it does: diff prints nothing and SAME when both match.

    Output

    SAME
    
  5. Commit your evidence

    git add . && git commit -qm "ch0 outputs" && git log --oneline | head -2
    

    What 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?

  1. Check your notes repo is clean

    git status --short
    

    What it does: No output means everything is committed.

    Output

    (no output means it worked)
    
  2. Count your evidence files

    ls | wc -l
    

    What 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

  1. Run pwd to see where you are.
  2. cd ~/devops-lab/notes.
  3. 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

  1. Run git config --global user.name "Your Name".
  2. Run git config --global user.email "you@example.com".
  3. 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

  1. Run sudo apt install -y util-linux.
  2. Run script again.

Cleanup

  1. Stop the background nginx

    docker ps -q --filter ancestor=nginx:1.27 | xargs -r docker rm -f
    

    What it does: Finds and removes the nginx container from the red error example.

    Output

    5b1c0e...
    
  2. Remove scratch files

    rm -f ~/devops-lab/notes/expected.txt ~/devops-lab/notes/mine.txt
    

    What 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!

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.

How:
  1. cp template.md 0.4.md
  2. 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.

How:
  1. Wrong command name.
  2. Wrong file path.
  3. 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.

How:
  1. Use diff -q.
  2. 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.

How:
  1. Write what problem it solves.
  2. Write one command or file you used for it.
  3. 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.

How:
  1. Open a fresh terminal.
  2. Type each command yourself.
  3. 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.

How:
  1. Follow one error section.
  2. Copy the exact message into your notes.
  3. 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.

How:
  1. 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.

How:
  1. 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.

How:
  1. One box per step.
  2. 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.

How:
  1. 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

  1. 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.

  2. 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.

  3. How do you keep a record of what you did on a server?

    Shell history, script recordings, and runbooks in Git.

  4. Why is cleanup important in the cloud?

    Running resources cost money and can be a security risk.

  5. 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.