4/21/2026

Linux for DevOps (Beginners)

Linux for DevOps (Beginners)


1. Linux Fundamentals


1.1 What is Open Source?

Open-source software is software whose source code is freely available for anyone to view, modify, and distribute. Linux is built on open-source principles.

  • Source code is publicly accessible
  • Community-driven development and contributions
  • Free to use, modify, and redistribute

Examples: Linux, Python, Firefox, Android


1.2 What is Linux?

Linux is a free, open-source operating system kernel created by Linus Torvalds in 1991. It powers everything from smartphones to supercomputers.

  • Linux is technically a kernel, not a full OS
  • Full OS = Linux Kemel + GNU tools + package manager + desktop environment
  • Popular distributions (distros): Ubuntu, Fedora, Debian, CentOS, Arch Linux
  • Used in servers, cloud, Android, loT, supercomputers


1.3 Linux vs UNIX

Linux =Free, open-source, kemel by Linus Torvalds (1991)

UNIX = Proprietary OS from Bell Labs (1969), not free

macos = UNIX-based (BSD), proprietary by Apple

Similarity = Both follow POSIX standards; Linux was inspired by UNIX


1.4 Why Use Linux?

  • Free and open source - no licensing costs
  • Highly secure - fewer viruses, strong permission model
  • Stable and reliable - servers run for years without reboots
  • Lightweight- runs on old hardware
  • Industry standard - most servers, cloud, and DevOps tools run on Linux
  • Customizable - choose your own components and desktop

1.5 Linux vs Windows

Cost => Linux is free; Windows requires a license
Security => Linux is free; Windows requires a license
Usage => Linux dominates servers; Windows dominates desktops
CLI => Linux is CLI-first; Windows is GUI-first
File System = > Linux: ext4, XFS; Windows: NTFS, FAT32
Software => Linux uses package managers; Windows uses installers (.exe)

1.6 What is a Kernel?

The kernel is the core of the operating system. It manages hardware resources and allows
software to communicate with hardware.
  • Manages CPU, memory, and I/O devices
  • Provides system calls for programs to request services
  • Acts as a bridge between applications and hardware
  • Linux kernel is monolithic - all kernel services run in kemel space

Installing Ubuntu via WSL (Windows Subsystem for Linux)
WSL lets you run a Linux terminal directly on Windows without a VM.
  • Open PowerShell as Administrator
  • Run: wsl -- install
  • Restart your PC
Open Ubuntu from the Start Menu
 - Set username and password on first launch

Useful WSL commands:
ws1 -- list -- verbose
wsl -- set-default-version 2

# Open Linux files in Windows Explorer

# List installed distros
# Use WSL 2

explorer.exe .


3. Basic Terminal Commands
3.1 Navigation


pwd

Print Working Directory - shows current location

1s
List files and directories

1s -la
List all files (including hidden) with details

od <dir>
Change directory

cd ..
Go up one directory level

cd ~
Go to home directory

cd /
Go to root directory



3.2 File and Directory Operations

mkdir <name>
Create a new directory

mkdir -p a/b/c
Create nested directories

touch <file>
Create an empty file or update timestamp

rm <file>
Remove a file

rm -r <dir>
Remove directory and contents recursively

rm -zf <dir>
Force remove without prompts (use carefully!)

cp <src> <dst>
Copy a file

mv <arc> <dst>
Move or rename a file

cat <file>
Display file contents

less <file>
Scroll through file contents

nano <file>
Open file in nano text editor

vim <file>
Open file in vim text editor


3.3 File Permissions - chmod
Linux file permissions control who can read, write, or execute files.

Permission format: rwxrwxrwx (owner / group / others)

r=4
Read permission

w= 2
Write permission

x= 1
Execute permission

chmod 755 file
Owner: rwx, Group: r-x, Others: r-x

chmod 644 file
Owner: rw-, Group: r-, Others: r-

chmod +x file
Add execute permission for all

chmod -w file
Remove write permission



3.4 Links
Links allow multiple references to the same file.

ln <src> <link>
Create a hard link - points to same inode

ln -s <src> <link>
Create a soft (symbolic) link - like a shortcut

alias 11='1s -la'
Create a command alias (session only)

Key difference: Deleting the original breaks a soft link but NOT a hard link.



4. File Handling & Text Processing
4.1 head & tail

head <file>
Show first 10 lines of a file

head -n 20 <file>
Show first 20 lines

tail <file>
Show last 10 lines

tail -f <file>
Follow file in real-time (great for logs)



4.2 wc -Word Count

we <file>
Show lines, words, and bytes

wc -1 <file>
Count lines only

wc -w <file>
Count words only

wc -c <file>
Count bytes/characters only

4.3 sort

sort <file>
Sort lines alphabetically

sort -r <file>
Sort in reverse order

sort -n <file>
Sort numerically

sort -u <file>
Sort and remove duplicates

sort -k2 <file>
Sort by the 2nd column

4.4 grep - Search Text
grep searches for patterns in files or output.

grep 'pattern' fileSearch for pattern in file
grep -i 'pattern'
file
Case-insensitive search
grep -r 'pattern'
dir/
Recursive search in directory
grep -n 'pattern'
file
Show line numbers with results
grep -v 'pattern'
file
Show lines that do NOT match
grep -c 'pattern'
file
Count matching lines
grep -E 'pllp2' fileExtended regex - match p1 OR p2



4/20/2026

Soft Skills - Do and Don't







Work Ethic

Do: Work hard without anyone asking and without complaining

Don't: Focus on number of hours outcomes are far more important


Growth Mindset

Do: Crave learning and feedback,and put those lessons to use

Don't: Be too arrogant to grow


Professionalism

Do: Act maturely and respectfully no matter who you're with

Don't: Think you can cross a line with certain people or situations


Self-Awareness

Do: Pay attention to how your words and actions come across

Don't: Make assumptions about what other people will think


Emotional Intelligence

Do: Notice your emotions and manage your responses to them

Don't: Act out of anger


Communication

Do: Be succinct, clear, and direct in writing and speaking

Don't: Think complexity makes you sound smart


Drive

Do: Dive into projects headfirst and before anyone has to ask

Don't: Depend on others for motivation - find it within


Collegiality

Do: Be kind and easy to work with

Don't: Take it too far - you can be likeable without being a pushover


Adaptability

Do: Adjust quickly when there's new information or circumstances

Don't: Fail to draw lessons from mistakes, and act on them


Dependability

Do: Keep your promises, staying true to your word every time

Don't: Make excuses


Active Listening

Do: Listen attentively, validate their points, and ask questions

Don't: Interrupt, multitask, or make things all about you


Time Management

Do: Stay organized, prioritize your tasks, and avoid distractions

Don't: Miss deadlines or take on more than you can handle


Persistence

Do: Be resilient after setbacks, continuing to move forward

Don't: Give up when it gets hard


Perceptiveness

Do: Pay attention to the mood and responses of others

Don't: Fail to make adjustments based on what you notice


Teamwork

Do: Collaborate well, sharing work, information, and credit

Don't: Try to do it all yourself - it won't work as well as you think


Integrity

Do: Tell the truth and make the ethical choice in all scenarios

Don't: Try to hide or cover up





Linux for DevOps (Beginners)

Linux for DevOps (Beginners) 1. Linux Fundamentals 1.1 What is Open Source? Open-source software is software whose source code is freely ava...