Part 1 Exercises
Prove to yourself that you've got it.
How to use these exercises
- Do these in your own terminal โ a Linux machine, a Mac, WSL on Windows, or any cloud server.
- Some are tasks to run. Some are questions to answer in writing. Some are scripts to write from scratch.
- The goal is not to find the answer online and paste it โ the goal is to do it, get stuck, figure it out, and remember it forever.
- There is no automated grader here. Your terminal is your grader.
Chapter 1 โ What is DevOps?
Without looking at the chapter, explain DevOps in two or three sentences as if you were telling a non-technical friend what you are studying. Then compare your explanation to the key-term definition in the chapter. What did you miss? What did you capture?
Think of a real-world situation โ from any domain, not necessarily software โ where two groups had opposite incentives that caused conflict. How was that conflict resolved (or how could it be)? Write a short paragraph comparing it to the Dev vs. Ops conflict described in Chapter 1.
Draw the DevOps infinity loop from memory on a piece of paper. Label each phase. For each phase, write one sentence describing what happens there. Do not look at the chapter until you are done. Check your answers afterward.
Look up the DORA (DevOps Research and Assessment) State of DevOps report for the most recent year available. Find the four key metrics DORA uses to measure DevOps performance (they are called the "Four Keys"). What are they? What does a "high-performing" team score on each metric?
Chapter 2 โ Linux
Open a terminal and complete the following tasks in order:
- Print your current working directory.
- Navigate to your home directory using the
~shortcut. - List all files and folders, including hidden ones, with full details (
ls -la). - Find the hidden
.bashrcor.zshrcfile. What is its size and last modified date? - Navigate to
/var/logand list the files there. What are the largest log files?
Using only the command line (no file manager, no IDE), create the following directory structure in your home directory:
~/my-devops-project/
โโโ src/
โ โโโ app.js
โโโ config/
โ โโโ production.env
โ โโโ development.env
โโโ scripts/
โ โโโ deploy.sh
โโโ README.md
Create the directories with mkdir -p and the files with touch.
When done, verify your structure with find ~/my-devops-project.
For each of the following permission strings, answer: who can do what? Identify the file type, owner permissions, group permissions, and other permissions.
-rw-r--r--drwxr-xr-x-rwx-------rw-------
Then run ls -la /etc/passwd on your system. What are the permissions
on that file? Why do you think they are set that way?
Create a fake log file with this command:
for i in {1..100}; do
if [ $((i % 7)) -eq 0 ]; then
echo "$(date) [ERROR] Database connection failed on attempt $i"
else
echo "$(date) [INFO] Request $i processed successfully"
fi
done > /tmp/app.log
Then answer these questions using only command-line tools:
- How many total lines does the file have?
- How many ERROR lines are there?
- Show only the ERROR lines.
- Show the last 5 lines of the file.
Hint: wc -l, grep, tail.
Generate a new SSH key pair on your machine:
ssh-keygen -t ed25519 -C "devops-practice-key"
Save it as ~/.ssh/id_devops_practice (a different filename than your default key).
Then:
- View your public key:
cat ~/.ssh/id_devops_practice.pub - Check the permissions:
ls -la ~/.ssh/ - Why must the private key be mode
600(not644)? What would SSH do if the permissions were too open?
Chapter 3 โ Networking
Use dig to investigate a domain of your choice. Run these commands
and answer the questions:
dig google.com
dig MX gmail.com
dig +trace github.com
- What IP address did
dig google.comreturn? Is it always the same? - What mail servers handle email for gmail.com? What does the number in the MX record mean?
- Describe in your own words what happened at each step of the
+traceoutput for github.com.
Use curl to make real HTTP requests. Run each command and read the output carefully:
# Basic GET request
curl https://httpbin.org/get
# POST with JSON body
curl -X POST https://httpbin.org/post \
-H "Content-Type: application/json" \
-d '{"name": "DevOps Student", "chapter": 3}'
# See the full HTTP response headers
curl -I https://github.com
# Follow redirects and show what happens
curl -L -v http://github.com 2>&1 | grep -E "^[*<>]"
After running these, answer: what status code does http://github.com (HTTP, not HTTPS) return, and where does it redirect to?
Find out what is listening on your machine right now:
ss -tlnp
List at least three services that are listening and identify what each one is. If you have a web server installed (nginx, apache), what port is it on? What about your database?
Then explain: if you wanted to allow a colleague to connect to your PostgreSQL database on port 5432 but block everyone else, how would you configure UFW to do that? Write out the commands, even if you don't run them.
Answer in your own words:
- You are building a live video streaming service where a dropped frame is no big deal but latency matters. Should your video data travel over TCP or UDP? Why?
- You are building a banking application where every transaction must be recorded and confirmed. Should it use TCP or UDP? Why?
- What protocol does DNS primarily use? Why does that make sense for short lookups?
Chapter 4 โ Git, Bash & Python
Complete this full Git workflow in your terminal, step by step:
- Create a new directory called
git-practiceand initialize a Git repo. - Create a file called
hello.txtwith the text "Hello, DevOps!" - Stage and commit the file with a meaningful message.
- Create a new branch called
feature/goodbye. - On that branch, create a file
goodbye.txtwith the text "See you in production." - Commit the new file.
- Switch back to
mainand merge your feature branch. - Run
git log --oneline --graph --allto see the history.
Copy the output of git log --oneline --graph --all into your notes.
Write a Bash script called greet.sh that:
- Accepts a name as the first argument (
$1). - If no argument is provided, prints "Usage: greet.sh <name>" and exits with code 1.
- Otherwise, prints "Hello, [name]! Welcome to DevOps." where [name] is replaced with the argument.
Make the script executable with chmod +x greet.sh and test it with:
./greet.sh Ushahemba and ./greet.sh (no argument).
Write a Bash script called backup.sh that:
- Takes a source directory as
$1and a backup destination as$2. - Creates the destination directory if it does not exist.
- Copies all files from source to destination.
- Prints a log line like:
[2026-05-06 09:14:22] Backed up /source to /dest - Uses
set -eso the script exits immediately if any command fails.
Test it by backing up ~/my-devops-project to /tmp/backup-test.
Write a Python script called count_lines.py that:
- Accepts a filename as a command-line argument (
sys.argv[1]). - Opens the file and counts the total number of lines.
- Also counts how many non-empty lines there are.
- Prints both counts in a readable format.
- If the file does not exist, prints a helpful error message and exits with code 1.
Test it on the /tmp/app.log file you created in Exercise 2.4.
This is a larger challenge that ties together multiple concepts from Part 1. Build a mini "deployment simulation":
-
Create a Git repository called
my-web-app. Add a file calledindex.htmlwith any HTML content you like. Commit it with a message "Initial commit". -
Create a branch called
feature/about-page. Add a fileabout.htmlwith a short "About Me" page. Commit it. Merge it back into main. -
Write a Bash script called
deploy-sim.shthat simulates a deployment:- Prints "Starting deployment..."
- Runs
git log --oneline -5to show recent commits - Counts the HTML files and prints "Deploying X HTML files"
- Prints "Deployment complete!"
-
Write a Python script called
check-deploy.pythat reads the directory, lists all.htmlfiles, and prints their names and sizes.
When you can run ./deploy-sim.sh and python3 check-deploy.py
from the same directory and see sensible output, you have completed Part 1.
If you completed all five exercises in the Chapter 4 section, you have practiced the core skills that will appear in every subsequent chapter: navigating Linux, reading and writing files, using Git for version control, writing Bash automation, and using Python for scripting. These are not just exercises โ they are the daily reality of DevOps engineering. Repeat them until the commands feel natural.
Part 1 Complete
- You understand what DevOps is, where it came from, and why it matters โ both culturally and economically.
- You can navigate a Linux file system, manage files and permissions, and control services with systemctl.
- You know how data travels across the internet: IP addresses, DNS resolution, TCP/UDP, HTTP requests and responses, and port numbers.
- You can use Git to version-control your work, create branches, merge changes, and view history.
- You can write Bash scripts that automate deployment tasks with proper error handling.
- You can write Python scripts to check application health, parse files, and interact with APIs.
- You are ready for Part 2: CI/CD and Containers.