Back to DevOps Platform

Linux for DevOps: Structured Beginner to Production Guide

Concept-first Linux learning for DevOps students: clear foundations, command practice, real production context, and troubleshooting confidence.

Progress Level

Beginner -> Intermediate

Estimated Time

Reading + practice: 30-40 minutes

Skill Outcome

Run, debug, and manage Linux servers for DevOps workflows

Linux Architecture Snapshot

Hardware
  ↓
Kernel
  ↓
Shell
  ↓
User Applications

Kernel manages hardware and system resources. Shell executes commands. Terminal is the interface to interact with shell. CLI is text-based; GUI is visual.

Linux File System Table

DirectoryPurpose
/Root directory (top-level path)
/homeUser files and user home folders
/etcSystem and service configuration files
/varLogs and variable runtime data
/binEssential base commands/binaries
/usrUser-installed programs and libraries

Path reminder: absolute path starts with `/`; relative path starts from current directory. Root `/` is different from home `~`.

1. What is Linux? (Foundation Concept)

What is it? Linux is an open-source operating system kernel. Most cloud and server environments run Linux-based systems.

Why it matters in DevOps? DevOps work is server-focused. If Linux concepts are unclear, tools like Docker, Kubernetes, and cloud operations become confusing.

Real-world example: Most Amazon Web Services EC2 instances use Linux distributions such as Ubuntu, Amazon Linux, or CentOS-like families.

Command Table

CommandPurpose
uname -aHands-on command practice for this concept.
cat /etc/os-releaseHands-on command practice for this concept.

Mini Practice Task

Check your kernel and distribution version on a Linux machine.

Common Mistakes

  • - Confusing Linux kernel with Linux distributions.
  • - Thinking Linux is only for programmers and not operations.

2. Linux Architecture (Big Picture Thinking)

What is it? Linux architecture flow: Hardware -> Kernel -> Shell -> User Applications. Terminal is the interface used to access shell commands.

Why it matters in DevOps? Understanding architecture helps students debug issues faster and know where a failure is happening.

Real-world example: If app is down, kernel resources, shell commands, and application process checks are all used together for diagnosis.

Command Table

CommandPurpose
echo $SHELLHands-on command practice for this concept.
ttyHands-on command practice for this concept.

Mini Practice Task

Print your shell type and identify your current terminal session.

Common Mistakes

  • - Treating shell and terminal as the same thing.
  • - Not understanding CLI vs GUI and why CLI is dominant in servers.

3. File System Structure (Very Important)

What is it? Linux follows an everything-is-a-file model. Key directories include /, /home, /etc, /var, /bin, and /usr.

Why it matters in DevOps? DevOps engineers frequently edit configs, read logs, and manage service files. Path clarity is essential.

Real-world example: Service failures are often fixed by checking files in /etc and logs in /var/log.

Command Table

CommandPurpose
pwdHands-on command practice for this concept.
ls -la /Hands-on command practice for this concept.
cd /etcHands-on command practice for this concept.
cd ~Hands-on command practice for this concept.

Mini Practice Task

Navigate from root (/) to home (~) and explain the difference in your notes.

Common Mistakes

  • - Assuming / and ~ are the same path.
  • - Editing files without confirming absolute path.

4. Permissions and Ownership (Critical for DevOps)

What is it? Linux permissions are based on User, Group, Others with r, w, x. Ownership and permissions control who can read, modify, or execute.

Why it matters in DevOps? Wrong permissions break deployments and can create security vulnerabilities in production.

Real-world example: A service can fail to start because app files are not executable or owned by the correct service user.

Command Table

CommandPurpose
ls -lHands-on command practice for this concept.
chmod 755 deploy.shHands-on command practice for this concept.
chown ubuntu:www-data app.confHands-on command practice for this concept.
sudo -lHands-on command practice for this concept.

Mini Practice Task

Create a script, make it executable, and run it as expected user.

Common Mistakes

  • - Using overly permissive chmod 777 in production.
  • - Changing ownership blindly without rollback path.

5. Process Management

What is it? A process is a running program with a PID. Processes can run in foreground or background. Services are managed process units.

Why it matters in DevOps? Production incidents require process-level checks: crashes, CPU spikes, memory pressure, and stuck services.

Real-world example: When a web app hangs, engineers inspect PID, kill stale process, and restart service cleanly.

Command Table

CommandPurpose
ps auxHands-on command practice for this concept.
topHands-on command practice for this concept.
kill -9 <pid>Hands-on command practice for this concept.
systemctl status nginxHands-on command practice for this concept.

Mini Practice Task

Start a test process, find its PID, and terminate it safely.

Common Mistakes

  • - Killing wrong PID in production.
  • - Ignoring systemctl and relying only on manual process commands.

6. Package Management

What is it? Packages are installable software units. Ubuntu uses apt, while RHEL/CentOS families use yum/dnf.

Why it matters in DevOps? Real DevOps workflows require installing and updating runtime tools and services securely.

Real-world example: Installing nginx, patching dependencies, and removing vulnerable packages are routine operational tasks.

Command Table

CommandPurpose
sudo apt updateHands-on command practice for this concept.
sudo apt install nginx -yHands-on command practice for this concept.
sudo apt remove nginx -yHands-on command practice for this concept.
sudo yum install nginx -yHands-on command practice for this concept.

Mini Practice Task

Install a package, verify service state, then remove it safely.

Common Mistakes

  • - Running upgrades in production without maintenance planning.
  • - Mixing apt and yum instructions on wrong distro.

7. Networking Basics

What is it? Core networking terms: IP address, port, DNS, localhost. Web traffic typically uses ports 80 (HTTP) and 443 (HTTPS).

Why it matters in DevOps? DevOps troubleshooting is heavily network-driven: DNS failures, port conflicts, connectivity problems.

Real-world example: Website outage investigation often begins with DNS resolution and service port checks.

Command Table

CommandPurpose
ping google.comHands-on command practice for this concept.
ss -lntpHands-on command practice for this concept.
curl -I http://localhost:80Hands-on command practice for this concept.
wget https://example.comHands-on command practice for this concept.

Mini Practice Task

Check which process is listening on port 80 or 443 on your server.

Common Mistakes

  • - Assuming app is down when only DNS is broken.
  • - Not checking bound ports before restart.

8. Logs and Monitoring

What is it? Logs record runtime events and errors. Most Linux logs are under /var/log. Commands like tail, grep, and less help inspect them.

Why it matters in DevOps? Logs are the fastest path to root cause analysis during incidents.

Real-world example: Engineers use tail -f during deploys to verify health and capture failure traces quickly.

Command Table

CommandPurpose
ls -la /var/logHands-on command practice for this concept.
tail -f /var/log/syslogHands-on command practice for this concept.
grep -i error /var/log/nginx/error.logHands-on command practice for this concept.
less /var/log/auth.logHands-on command practice for this concept.

Mini Practice Task

Find one error pattern in a log file and summarize what it means.

Common Mistakes

  • - Ignoring logs and guessing root cause.
  • - Searching logs without narrowing scope by service/time.

9. Environment Variables

What is it? Environment variables store runtime configuration like PATH, API keys, and environment mode.

Why it matters in DevOps? Docker, Kubernetes, and CI/CD pipelines depend on environment variables for clean configuration management.

Real-world example: Production apps load DB host, port, and credentials from environment variables instead of hardcoded values.

Command Table

CommandPurpose
echo $PATHHands-on command practice for this concept.
export APP_ENV=productionHands-on command practice for this concept.
source ~/.bashrcHands-on command practice for this concept.
printenv | grep APP_ENVHands-on command practice for this concept.

Mini Practice Task

Set a temporary variable, reopen shell, and verify persistence behavior.

Common Mistakes

  • - Hardcoding secrets in source code.
  • - Forgetting difference between .bashrc and .profile scope.

10. Shell and Bash Basics

What is it? Bash is a common shell used for automation. Shell scripts combine commands, variables, conditions, and loops.

Why it matters in DevOps? DevOps automation depends on scripts for deployment, backups, and health checks.

Real-world example: Teams run scheduled scripts to collect health metrics, rotate logs, and restart failed services.

Command Table

CommandPurpose
#!/bin/bashHands-on command practice for this concept.
if [ -f file.txt ]; then echo ok; fiHands-on command practice for this concept.
for i in 1 2 3; do echo $i; doneHands-on command practice for this concept.

Mini Practice Task

Write a script that checks a service status and prints success/failure.

Common Mistakes

  • - Writing scripts without set -e safety mindset.
  • - Running untested scripts directly on production.

11. Disk and Memory Management

What is it? Disk and memory metrics indicate host health. Key commands: df, du, free, uptime.

Why it matters in DevOps? Servers crash or degrade when disk is full or memory pressure is ignored.

Real-world example: A full /var partition can stop logging and break deployments.

Command Table

CommandPurpose
df -hHands-on command practice for this concept.
du -sh /var/*Hands-on command practice for this concept.
free -mHands-on command practice for this concept.
uptimeHands-on command practice for this concept.

Mini Practice Task

Identify top disk-consuming directories and document cleanup actions.

Common Mistakes

  • - Only checking CPU and ignoring disk/memory.
  • - Deleting files blindly without impact check.

12. Real DevOps Context

What is it? Linux is the backbone for server setup, SSH operations, web server deployment, and cloud instance management.

Why it matters in DevOps? Students must connect commands to production workflows and career outcomes.

Real-world example: Linux powers workloads across Amazon Web Services, Google Cloud, and Microsoft Azure.

Command Table

CommandPurpose
ssh ubuntu@<server-ip>Hands-on command practice for this concept.
sudo systemctl restart nginxHands-on command practice for this concept.
journalctl -u nginx --since "15 min ago"Hands-on command practice for this concept.

Mini Practice Task

Provision one Linux VM, deploy a simple web server, and capture a troubleshooting note.

Common Mistakes

  • - Learning command lists without applying in scenarios.
  • - Skipping troubleshooting practice.

Linux Master Command Reference (16 Categories)

Complete command map for Linux + DevOps practice. Use this as your revision checklist.

1. File and Directory Management

  • - pwd - Show current directory
  • - ls - List directory contents
  • - ls -l - Detailed listing (permissions, size, owner)
  • - ls -a - Show hidden files
  • - tree - Display directory structure
  • - cd - Change directory
  • - pushd / popd - Save and restore directory stack
  • - dirs - Show directory stack
  • - mkdir / mkdir -p - Create directories
  • - rmdir - Remove empty directory
  • - rm / rm -r / rm -f - Remove files and directories
  • - cp / cp -r - Copy files and directories
  • - mv - Move or rename files/directories
  • - install - Copy files and set attributes
  • - basename / dirname - Extract file/path parts
  • - realpath / readlink - Resolve absolute/symlink paths
  • - stat - Display detailed file/filesystem status
  • - file - Determine file type
  • - touch - Create file or update timestamps
  • - chattr / lsattr - Manage special file attributes
  • - rename - Rename multiple files using patterns
  • - vdir - Verbose directory listing

2. File Viewing and Editing

  • - cat / tac - Print file content (normal/reverse)
  • - less / more - Paged file viewing
  • - head / tail / tail -f - Read top, bottom, and live updates
  • - nl - Number lines
  • - wc - Count lines, words, bytes
  • - sort / uniq - Sort and deduplicate lines
  • - cut / paste - Slice and merge columns
  • - column - Format content in columns
  • - expand / unexpand - Tabs <-> spaces conversion
  • - fold / fmt - Wrap and format text
  • - strings - Extract printable strings from binary
  • - od / xxd - Octal/hex dump utilities
  • - nano / vi / vim / emacs - Terminal editors

3. Permissions and Ownership

  • - chmod / chmod +x - Change permissions and make scripts executable
  • - chown / chgrp - Change owner/group
  • - umask - Set default file creation permissions
  • - getfacl / setfacl - Fine-grained Access Control Lists
  • - id / groups / whoami - Inspect user/group identity

4. User and Group Management

  • - useradd / adduser - Create user
  • - usermod / userdel - Modify/delete user
  • - groupadd / groupmod / groupdel - Manage groups
  • - passwd / chage - Password and expiry management
  • - su / sudo - Switch or elevate user context
  • - visudo - Safely edit sudoers policy

5. Process Management

  • - ps / ps aux - Process snapshot
  • - top / htop / atop - Dynamic process and system view
  • - kill / kill -9 - Send signals to processes
  • - pkill / pgrep - Match processes by name/attributes
  • - nice / renice - Priority management
  • - bg / fg / jobs / disown - Job control
  • - watch - Run command periodically
  • - time - Measure execution resources
  • - uptime / tload - Load and uptime checks
  • - strace - Trace syscalls and signals

6. Networking

  • - ping - Connectivity check
  • - curl / wget - Data transfer and downloads
  • - scp / rsync - Secure copy and sync
  • - ssh / sftp - Remote shell and transfer
  • - nc (netcat) - Raw network reads/writes
  • - netstat / ss - Connections and sockets
  • - ip addr / ip route - IP and routing
  • - traceroute / mtr - Path tracing
  • - nslookup / dig - DNS lookup
  • - whois - Domain registration info
  • - nmap - Network scan and discovery

7. Package Management (Debian/Ubuntu)

  • - apt update / apt upgrade - Refresh and upgrade packages
  • - apt install - Install package
  • - apt remove / apt purge - Remove package (purge removes configs)
  • - apt search - Search packages
  • - dpkg -i - Install local .deb
  • - add-apt-repository - Add PPA repository

8. Service Management (systemd)

  • - systemctl start/stop/restart - Service lifecycle control
  • - systemctl status - Service health check
  • - systemctl enable/disable - Boot-time service control
  • - journalctl / journalctl -f - Service and system logs

9. Disk and Storage

  • - df -h - Filesystem usage
  • - du -sh - Directory usage summary
  • - lsblk - Block device map
  • - mount / umount - Mount operations
  • - fdisk / parted - Partition management
  • - mkfs - Create filesystem
  • - fsck - Filesystem check and repair
  • - blkid - UUID/device metadata

10. Search and Text Processing

  • - grep / grep -r - Pattern matching
  • - sed - Stream editing
  • - awk - Structured text processing
  • - xargs - Build command arguments
  • - diff - Compare files
  • - find - Hierarchical file search
  • - locate - DB-backed fast file search

11. Scheduling

  • - crontab -e - Scheduled recurring jobs
  • - at - One-time scheduled command
  • - sleep - Delay execution

12. System Information

  • - uname -a - Kernel and system information
  • - lscpu - CPU architecture info
  • - free -m - Memory usage
  • - lspci / lsusb - Hardware buses
  • - dmesg - Kernel ring buffer

13. Compression and Archiving

  • - tar -cvf / tar -xvf - Archive create/extract
  • - gzip / gunzip - Compress/decompress
  • - zip / unzip - ZIP utilities

14. Shell and Environment

  • - echo - Print text/value
  • - export - Set environment variable
  • - alias - Command shortcut
  • - history - Command history
  • - source (.) - Load shell file in current session

15. Modern Advanced Replacements

  • - bat (cat with highlighting)
  • - eza (modern ls)
  • - fd (fast find)
  • - procs (modern ps)
  • - duf / dust (disk usage tools)
  • - btm (bottom system monitor)
  • - rg (ripgrep search)
  • - tldr (simplified manual)
  • - fzf (fuzzy finder)

16. Containers (Docker)

  • - docker ps - List running containers
  • - docker images - List local images
  • - docker exec -it <id> bash - Enter running container
  • - docker logs -f - Follow container logs
  • - docker-compose up - Multi-container orchestration

If These Concepts Are Clear, Student Will

  • - Not fear terminal usage.
  • - Understand server behavior logically.
  • - Debug issues step-by-step with confidence.
  • - Move confidently to Docker and Kubernetes.
  • - Crack DevOps interviews with practical clarity.