DEV Community

Muhammad Khizr Khan
Muhammad Khizr Khan

Posted on AI-assisted

DevOps from Zero #1: Linux and the Terminal, explained simply

I'm Muhammad Khizr Khan, a computer science student and full-stack/DevOps developer. I'm learning DevOps in public, one class at a time, and writing each class up so a complete beginner can follow it. This is Class 01.

What DevOps actually is

Developers build software. Operations keep it running. DevOps joins the two into one loop and automates every step:

plan → code → build → test → release → deploy → operate → monitor → (back to plan)

Without DevOps With DevOps
Manual deploys Automated pipelines
"Works on my machine" The same environment everywhere
A release every few months Safe releases many times a day

The roadmap for this series

  1. Linux & Bash ← you are here
  2. Networking
  3. Git & GitHub
  4. Docker
  5. CI/CD
  6. AWS cloud
  7. Terraform
  8. Kubernetes

Why Linux comes first

Your code doesn't run on your laptop. It runs on servers, and most internet servers, almost every container and the machines under Kubernetes run Linux. If you can't move around a Linux terminal, everything later in DevOps feels like magic.

The layers: you → shell → kernel → hardware

Layer What it does
You Type commands
Shell (bash) Reads your command and asks the kernel to do it
Kernel Manages CPU, memory, files and network
Hardware CPU, RAM, disk, network card

The terminal is the window you type in. The shell is the program inside it that understands what you type.

How to read any command

ls -la /var/log
Enter fullscreen mode Exit fullscreen mode
  • Command ls: what to do (list files)
  • Options -la: how to do it. -l is the long format, -a includes hidden files
  • Argument /var/log: what to do it on

Three rules that save hours:

  1. Linux is case-sensitive. File.txt and file.txt are different files.
  2. Options start with -.
  3. Stuck? Run man ls or ls --help.

The filesystem: one tree, no drive letters

There is no C: or D:. Everything hangs off a single tree that starts at /.

Path Holds
/home Users' files
/etc Configuration
/var Logs and data that changes
/usr Installed programs
/tmp Temporary files, wiped on reboot
/root The admin's home folder

Two places you'll open again and again as a DevOps engineer: /etc/nginx/nginx.conf and /var/log/syslog.

Moving around

pwd            # where am I?
ls             # what's here?
cd projects    # go into a folder
cd ..          # up one level
cd /var/log    # absolute path (starts with /)
cd ~           # home
cd -           # back to the previous folder
Enter fullscreen mode Exit fullscreen mode

An absolute path starts with / and works from anywhere. A relative path starts from where you are now.

Working with files

mkdir app          # new folder (mkdir -p a/b/c for nested folders)
touch app.log      # empty file
cp a.txt b.txt     # copy (cp -r for folders)
mv a.txt docs/     # move or rename
cat notes.txt      # print a file
rm old.txt         # delete (rm -r for folders)
Enter fullscreen mode Exit fullscreen mode

⚠️ rm deletes forever. There is no Recycle Bin.

Permissions: what does 754 mean?

ls -l shows something like -rwxr-xr--. Split it into three groups:

  • Owner rwx
  • Group r-x
  • Others r--

Each letter is worth a number: r = 4, w = 2, x = 1. Add them up per group:

  • Owner rwx = 4 + 2 + 1 = 7
  • Group r-x = 4 + 0 + 1 = 5
  • Others r-- = 4 + 0 + 0 = 4

So the file is 754.

chmod 754 deploy.sh
chmod +x deploy.sh   # make a script runnable
Enter fullscreen mode Exit fullscreen mode

Pipes: small tools become superpowers

The | sends one command's output into the next one:

cat access.log | grep " 404 " | wc -l   # how many "page not found" errors?
Enter fullscreen mode Exit fullscreen mode

Three tiny tools, one useful answer. This idea shows up everywhere in DevOps.

🧪 Lab (20 minutes)

On Windows, install Linux first: open PowerShell as administrator, run wsl --install, then restart.

  1. Print your username and current folder: whoami, pwd
  2. Create ~/devops/class-01/notes in one command: mkdir -p ~/devops/class-01/notes
  3. Make hello.sh, copy it, then rename the copy (touch, cp, mv)
  4. Set its permissions to 754 and check them: chmod 754 hello.sh, then ls -l
  5. Count the entries in /etc with a pipe: ls /etc | wc -l

Next class

Bash scripting: putting these commands in a file and letting the computer do the work. That's your first real automation.


I'm Muhammad Khizr Khan, a full-stack & DevOps developer and the founder of Axelink Systems. More of my work is on my portfolio, LinkedIn and GitHub. Questions about the lab? Leave a comment and I'll answer.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

This is a strong opening class, and the two explanations I would steal for teaching anyone are the terminal-versus-shell distinction and the 754 breakdown. Beginners conflate the window with the program inside it for months, and most tutorials jump straight to "run chmod 754" without ever showing that rwx is just 4 + 2 + 1 per group. Walking through -rwxr-xr-- letter by letter is what makes the number stop feeling like magic.

The lab is the right call too — nobody learns permissions by reading about them, they learn them the first time they chmod the wrong folder and have to work out what they just did. If I could add one thing to the next class, it would be exactly that: a short "what to do when you break it" section, because the rm-has-no-Recycle-Bin warning is the most important line in this post, and a beginner will test it sooner or later.

One question: when you get to the Docker class in this series, will you build on this same lab setup — the ~/devops/class-01 folder and hello.sh — so readers see the same project move from a local script to a container?