What Is Linux?
Linux is a beginner-level DevOps tool used to manage specific parts of software delivery and operations. It helps teams standardize workflows and reduce manual effort.
Foundations
Linux is the base operating system for most DevOps workloads.
Level: BeginnerLinux is a beginner-level DevOps tool used to manage specific parts of software delivery and operations. It helps teams standardize workflows and reduce manual effort.
Teams use Linux to improve speed, reliability, and consistency. It reduces repetitive manual work, lowers failure risk, and makes collaboration easier across development and operations.
It sits at the base of every DevOps workflow. Without this layer, CI/CD, cloud, and reliability work become slow and error-prone.
Start with core Linux concepts and basic setup so you can use it safely in day-to-day work.
- Understand Linux fundamentals
- Set up local/dev environment
- Run first working example
Integrate Linux into real team practices with repeatable conventions and collaboration patterns.
- Adopt standards and naming conventions
- Integrate with repositories and CI/CD
- Create reusable templates
Use Linux in production with observability, security, and rollback plans.
- Monitor behavior and failures
- Secure access and secrets
- Define incident and rollback flow
Continuously improve reliability, performance, and cost while standardizing usage across services.
- Improve performance and cost
- Automate compliance checks
- Document best practices for the team
- Filesystem
- Permissions
- Processes
- Shell basics
- User and permission management
- Service operations
- Local and remote server operations
- Code collaboration workflows
- Task automation in build and deploy scripts
- Read the Linux basics and terminology
- Run at least one hands-on mini project
- Break and fix a small setup to build confidence
- Document your first repeatable workflow
- Integrate Linux with your full delivery pipeline
- Add security and policy checks
- Add observability and incident playbooks
- Define reusable standards for multiple services
- Using defaults in production without security hardening
- Skipping monitoring and post-deployment validation
- No rollback strategy for failed changes
- Over-complex setup before mastering fundamentals
- Access control and least privilege applied
- Secrets managed securely
- Monitoring and alerting enabled
- Rollback and recovery process tested
- Documentation updated for team onboarding
Install Linux on host with practical commands and verification steps.
Ubuntu/Debian base update
sudo apt update && sudo apt upgrade -yInstall common Linux admin packages
sudo apt install -y curl wget git vim htop net-tools unzip zipVerify Linux kernel and distro
uname -a
cat /etc/os-releaseCheck OS details
uname -aList files
ls -laFind current path
pwdSimple command list with short descriptions.
uname -aKernel + OS information (fast environment check).
whoamiShow the current user (helps with permission issues).
pwdPrint current working directory.
ls -lahList files with human sizes + hidden files.
cd -Jump back to previous directory.
tree -L 2Show folder tree up to depth 2 (install `tree` if missing).
cat file.txtPrint a file.
less file.txtRead large files safely (search with `/`).
head -n 50 file.txtShow first N lines.
tail -n 50 file.txtShow last N lines.
tail -f /var/log/syslogFollow logs live (Debian/Ubuntu).
grep -R "needle" .Recursive text search in current folder.
rg "needle" .Fast recursive search (ripgrep).
find . -type f -name "*.log"Find files by pattern.
chmod 644 file.txtSet permissions (rw-r--r--) for a file.
chmod -R u+rwX,go-rwx secret_dirMake dir private for owner.
chown -R user:group /pathChange ownership recursively.
idShow uid/gid and groups for current user.
ps aux | headList processes (classic view).
topInteractive process viewer (CPU/mem).
free -hMemory usage summary.
df -hDisk usage by filesystem.
du -sh * | sort -hFind large folders/files in current directory.
ss -lntpShow listening TCP ports and processes.
curl -I https://example.comFetch HTTP headers (quick health check).
dig example.comDNS lookup.
systemctl status nginxCheck service status (systemd).
systemctl restart nginxRestart a service.
journalctl -u nginx -n 200 --no-pagerShow last logs for a systemd unit.
sudo -lShow allowed sudo commands (permission debugging).
Official documentation:
https://www.kernel.org/doc/html/latest/A full, structured guide for this tool (with commands, diagrams, best practices, and learning path).
This page is written like a tutorial handbook. Each tutorial includes:
If you are new to Linux, do Tutorials 1 to 4 first. If you are already comfortable with the terminal, jump to Tutorials 6 to 10 and the Advanced Topics.
Use any Linux machine:
Create a safe practice folder:
mkdir -p ~/linux-labs/{files,logs,scripts}
cd ~/linux-labs
If you break something, delete the lab folder and start fresh:
rm -rf ~/linux-labs
pwd)ls)cd). and ..)Show your current directory:
pwd
List files:
ls
ls -la
ls -lh
Move around:
cd ~
cd /tmp
cd -
/var/log is an absolute path.../logs is a relative path.. means “this directory”... means “parent directory”.~/linux-labs/files/tutorial-1.backups.backups, then return back to your home directory without typing the full path.Create files and directories:
cd ~/linux-labs/files
mkdir -p tutorial-2
cd tutorial-2
touch notes.txt
Write to a file:
echo "hello linux" > notes.txt
echo "second line" >> notes.txt
Read a file:
cat notes.txt
nl -ba notes.txt
Preview a large file:
less /etc/services
Search inside files:
grep -n "ssh" /etc/services | head
Pipes:
ps aux | head
ps aux | grep -i ssh
todo.txt with 10 lines.learn (case-insensitive).Useful commands:
wc -l todo.txt
grep -ni "learn" todo.txt
r), write (w), execute (x)See permissions:
ls -l
Change permissions:
chmod 644 notes.txt
chmod 755 .
Change ownership (requires sudo):
sudo chown $USER:$USER notes.txt
r to read, w to edit, and x to run as a program.x to enter (cd) and access files inside.hello.sh.cat > hello.sh <<'SH'
#!/usr/bin/env bash
echo "hello from a script"
SH
./hello.sh
chmod +x hello.sh
./hello.sh
List processes:
ps aux | head
Interactive view:
top
Find a process:
ps aux | grep -i node
Send a signal:
kill -TERM <pid>
kill -KILL <pid>
TERM is “please stop gracefully”.KILL is “stop now” (use only when needed).sleep 9999 in one terminal.kill -TERM.Different Linux distributions use different package managers.
sudo apt update
sudo apt install -y curl jq
sudo apt upgrade -y
sudo dnf install -y curl jq
Check network interfaces:
ip a
Check routes:
ip route
DNS lookup:
getent hosts devopslabx.com
Check listening ports:
ss -lntp | head
Test HTTP:
curl -I https://devopslabx.com
3000 (if your Next.js app is running).ss -lntp | grep ':3000' || true
curl -I http://localhost:3000 || true
/var/log)Common system logs:
ls -la /var/log | head
Follow a log:
tail -f /var/log/syslog 2>/dev/null || true
tail -f /var/log/messages 2>/dev/null || true
Systemd journal:
journalctl -n 100 --no-pager
journalctl -u ssh --since "1 hour ago" --no-pager
Who am I:
whoami
id
groups
Create a user (admin-only):
sudo useradd -m -s /bin/bash demo-user
sudo passwd demo-user
SSH basics:
ssh user@server-ip
Generate an SSH key:
ssh-keygen -t ed25519 -C "devopslabx"
systemctl status ssh
sudo systemctl restart ssh
sudo systemctl enable ssh
journalctl -u ssh --no-pager -n 200
Create a simple service that prints a timestamp to a log every 10 seconds:
cat > ~/linux-labs/scripts/tick.sh <<'SH'
#!/usr/bin/env bash
while true; do
date -Is
sleep 10
done
SH
chmod +x ~/linux-labs/scripts/tick.sh
You can later run it under a service unit, but only do that after you understand permissions and paths.
cat > ~/linux-labs/scripts/check_port.sh <<'SH'
#!/usr/bin/env bash
set -euo pipefail
host="${1:-localhost}"
port="${2:-3000}"
if command -v nc >/dev/null 2>&1; then
nc -zv "$host" "$port"
else
echo "nc not installed. Try: sudo apt install -y netcat-openbsd"
exit 2
fi
SH
chmod +x ~/linux-labs/scripts/check_port.sh
~/linux-labs/scripts/check_port.sh localhost 3000
set -euo pipefail for safer scripts.Disk usage (what is full?):
df -h
Big folders (what is consuming space?):
du -sh /var/* 2>/dev/null | sort -h | tail
List block devices:
lsblk
See mounts:
mount | head
/var.Useful inode command:
df -ih
sudo sshd -T | head
sudo cat /etc/ssh/sshd_config | sed -n '1,120p'
sudo ufw status verbose || true
Allow SSH first (important), then enable:
sudo ufw allow OpenSSH
sudo ufw enable
ss -lntp
Edit your user crontab:
crontab -e
List your cron jobs:
crontab -l
Example: run every day at 2:15 AM (log output):
15 2 * * * /home/<user>/linux-labs/scripts/backup.sh >> /home/<user>/linux-labs/logs/backup.log 2>&1
ps aux | grep -i <service-name> | head
ss -lntp | grep ':<port>' || true
journalctl -u <service-name> --no-pager -n 200
df -h
free -m
top
uptime
free -m
df -h
Interpretation tips:
This is the mental model behind containers.
When a container “works locally” but fails in production, the real cause is often:
A real, visual mental model of how Linux fits into a typical workflow.
Fundamental Architecture of Linux
Layered view: user space calls into the kernel through the system call interface, running on hardware.
A production-oriented view: guardrails, checks, and the parts that matter when it breaks.
Production Reference Flow
This diagram is a practical mental model, not vendor-specific.
/etc config, /var variable data, /home user data.Filesystem and navigation:
pwd
ls -la
cd /path
du -sh *
df -h
Search and text:
grep -Rni "pattern" .
find . -type f -name "*.log"
Processes:
ps aux | head
top
kill -TERM <pid>
Networking:
ip a
ip route
ss -lntp
curl -I https://example.com
System services:
systemctl status <service>
journalctl -u <service> --no-pager -n 200
Scenario: You expect a service on http://localhost:3000 but it is failing.
Checklist:
Commands:
ss -lntp | grep ':3000' || true
ps aux | grep -i node | head
df -h
cd ~/linux-labs/files
echo "secret" > locked.txt
chmod 444 locked.txt
echo "try" >> locked.txt || true
chmod 644 locked.txt
echo "fixed" >> locked.txt
mount shows what is attached.fstab defines persistent mounts (be careful).mount | head
cat /etc/fstab
top, mpstatfree -m, vmstatiostat, df, duYes. Most infrastructure, containers, CI runners, and servers are Linux-based. Linux makes everything else easier.
Git, CI/CD, Docker, Kubernetes, Terraform, and monitoring. Linux is the foundation that makes these tools feel “logical”.
Extra long-form notes for Linux. This loads on demand so the page stays fast.