๐Ÿง DevOps Roadmap 2025 โ€“ Step 2: Mastering Linux for DevOps Engineers For Beginners & Experienced Learn Linux from scratch and become a DevOps pro!

Harshal SonarHarshal Sonar
7 min read

๐Ÿ“Œ Introduction

This is Step 2 in our DevOps Roadmap 2025 series.

If you're learning DevOps, Linux is not optional โ€” itโ€™s the foundation of everything: servers, cloud, containers, automation tools, and pipelines.

In this blog, youโ€™ll learn:

  • Why Linux is essential in DevOps

  • How to use Linux on Windows

  • Linux commands for real-world DevOps tasks

  • What is apt, yum, and how Linux handles software

  • Interview questions with answers

  • Practical Linux usage in Azure DevOps

Letโ€™s begin.


๐ŸŒ Why Linux is Crucial for DevOps

Hereโ€™s why DevOps Engineers rely on Linux:

  • Most cloud servers use Linux (AWS EC2, Azure VMs, GCP)

  • CI/CD pipelines often run on Linux agents

  • Tools like Docker, Kubernetes, Jenkins, Terraform run best on Linux

  • Scripting and automation are more powerful with Bash

  • Linux is open-source, stable, and secure

๐Ÿ’ก 90% of cloud infrastructure runs on Linux.


๐Ÿ’ป What is Linux?

Linux is a free and open-source operating system that works like Unix. It powers servers, cloud systems, mobile phones, and supercomputers.

Key Linux Components:

  • Kernel โ€“ The core engine that interacts with hardware

  • Shell โ€“ Command-line interface to talk to the system

  • Filesystem โ€“ Hierarchical directory structure starting from /


๐Ÿงฑ Linux Distributions (Distros)

A Linux distribution is a version of Linux packaged with tools and settings.

DistroBest ForPackage ManagerFree/Paid
UbuntuBeginners, DevOps, cloudaptFree
DebianStability, scriptingaptFree
CentOSEnterprisesyumFree
RHELCorporate useyumPaid
AlpineDocker containersapkFree

๐Ÿ“ฆ What is a Package Manager in Linux?

Just like Windows uses .exe files and Android uses .apk, Linux uses packages to install software.

Package Managers are tools to manage, install, update, and remove software.

Package ManagerUsed InExample Command
apt (Advanced Package Tool)Ubuntu/Debiansudo apt install nginx
yum (Yellowdog Updater Modified)CentOS/Red Hatsudo yum install nginx
apkAlpine Linuxapk add nginx

๐Ÿ” These tools automatically fetch software from the internet, resolve dependencies, and install.


๐ŸชŸ Can You Use Linux on Windows?

Yes! You donโ€™t need to install Linux separately โ€” use it inside Windows.

โœ… Best Options:

ToolDescription
WSLRun full Linux (Ubuntu) inside Windows Terminal
Git BashLightweight Bash emulator
VirtualBoxInstall full Linux as a virtual machine

๐Ÿ’ก Install Ubuntu via WSL on Windows using:

wsl --install

๐Ÿ–ฅ๏ธ What is #!/bin/bash in Shell Scripts?

The first line in many Linux scripts is:

#!/bin/bash

Itโ€™s called a shebang. It tells Linux which interpreter to use.

  • #! โ€“ Signals a script interpreter

  • /bin/bash โ€“ Path to Bash shell

๐Ÿ” How to find your shell path?

which bash

Example output:

/bin/bash

You can also use:

#!/usr/bin/env bash

This is more portable and works across systems.


๐Ÿค– Using Linux VM as Agent in Azure DevOps

Linux virtual machines can be used as build agents in Azure DevOps pipelines, providing a reliable and efficient environment for running DevOps tasks and automation.


๐Ÿ“œ Important Linux Commands for DevOps

Letโ€™s explore key Linux commands with explanations.

๐Ÿ”น File and Folder Commands

pwd                    # Show current directory
ls -lh                 # List with size and details
cd /var/log            # Change directory
mkdir myproject        # Create folder
touch file.txt         # Create empty file
rm -rf temp/           # Delete folder recursively

๐Ÿ”น File Viewing & Editing

cat file.txt           # Show file content
less file.txt          # Scrollable view
head -n 5 file.txt     # First 5 lines
tail -n 10 file.txt    # Last 10 lines

๐Ÿ”น Sorting & Filtering

sort names.txt                 # Sort lines alphabetically
sort -n numbers.txt           # Sort numerically
uniq sorted.txt               # Remove duplicates
grep "error" logfile.txt       # Find lines with "error"
wc -l file.txt                 # Count lines

๐Ÿ”น User & Group Management

sudo adduser devuser              # Add user
sudo deluser devuser              # Delete user
sudo groupadd devgroup            # Add group
sudo usermod -aG devgroup devuser # Add user to group

๐Ÿ” Understanding chmod 777 โ€“ File Permissions in Linux

When you run this command:

chmod 777 filename

You're setting the permissions of the file to 777. But what does that mean? Letโ€™s break it down step by step.


๐Ÿ“ Linux File Permission Basics

Linux assigns three types of permissions to each file or directory:

PermissionSymbolMeaning
ReadrCan read/view file
WritewCan edit or delete
ExecutexCan run as a program or script

And these are assigned to three types of users:

  1. Owner (User who owns the file)

  2. Group (Users in the same group)

  3. Others (Everyone else)


๐Ÿง  What Does 777 Mean?

Each permission is assigned a numeric value:

  • Read (r) = 4

  • Write (w) = 2

  • Execute (x) = 1

To set permissions, we add the numbers:

  • 7 = 4 + 2 + 1 โ†’ read + write + execute

  • So 777 means:

    • Owner: 7 โ†’ read, write, execute

    • Group: 7 โ†’ read, write, execute

    • Others: 7 โ†’ read, write, execute

This means everyone has full access to the file or directory โ€” they can read, modify, and run it.


๐Ÿ”น System Monitoring

top                     # Live CPU/memory usage
df -h                   # Disk usage
free -m                 # Memory in MB
uptime                  # System running time

๐Ÿ”น Networking Commands

ip a                    # Show IP addresses
ping google.com         # Test network connectivity
curl ifconfig.me        # Show public IP address

๐Ÿ”น File Creation Techniques (Interview Tip)

How many ways to create a file?

  • touch file.txt

  • echo "data" > file.txt

  • cat > file.txt

  • vi file.txt

  • nano file.txt


๐Ÿ“˜ Interview Questions

๐Ÿ’ก For Freshers

Q1. What is Linux?
A free and open-source operating system used for servers and cloud.

Q2. Whatโ€™s the difference between apt and yum?

  • apt โ†’ Ubuntu/Debian

  • yum โ†’ CentOS/Red Hat
    Both are used to install software.

Q3. How do you create a new user in Linux?

sudo adduser newuser

Q4. Why do we add #!/bin/bash in scripts?
It tells the OS to use Bash to run the script.


๐Ÿ’ก For Experienced Engineers

Q1. How do you use a Linux VM as an agent in Azure DevOps?
Linux VMs can serve as self-hosted agents to run your pipelines and automation efficiently.

Q2. Whatโ€™s the difference between chmod 755 and 777?

  • 755: Owner can read/write/execute; others read/execute

  • 777: Everyone can read/write/execute (insecure)

Q3. What is the difference between sort, uniq, and grep?

  • sort โ€“ Arranges lines

  • uniq โ€“ Removes duplicate lines

  • grep โ€“ Filters lines based on keywords

Q4. How to monitor disk usage sorted by size?

du -sh * | sort -h

๐Ÿ”š Summary

Youโ€™ve now mastered:

โœ… Linux basics
โœ… What are apt and yum package managers
โœ… Using Linux with Windows
โœ… File, system, network, user commands
โœ… #!/bin/bash and why it matters
โœ… Using Linux VMs as Azure DevOps agents
โœ… Real-world interview Q&A


๐Ÿ“˜ Next in the DevOps Roadmap

โžก๏ธ Step 3: Mastering Terraform โ€“ Infrastructure as Code


๐Ÿ’ฌ Loved this blog?

๐Ÿ‘ Like & share with fellow DevOps learners
๐Ÿ”— Post on LinkedIn, Dev.to, or Hashnode
๐Ÿ—ฃ๏ธ Comment your doubts or questions below

0
Subscribe to my newsletter

Read articles from Harshal Sonar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Harshal Sonar
Harshal Sonar